On a sharp lemma of Cassels and Montgomery on manifolds