A congruence for the Fourier coefficients of a modular form and its application to quadratic forms