  We optimize optical performance of metasurfaces based on periodically
corrugated silicon layers by adjusting the Fourier coefficients of their
surface profile. For smooth corrugations, we demonstrate an excellent
quantitative accuracy of semi-analytical approach based on the Rayleigh
hypothesis. We employ the approach to design metasurfaces with anomalous
refraction due to dominant first order diffraction. Unlike conventional
Huygens' dielectric metasurfaces, corrugated silicon layers are capable of
efficient anomalous refraction in grazing directions: we obtain corrugation
shapes allowing to deflect 70-80% of the energy of normally incident green
light into the range of 68{\deg}-85{\deg} of angles with respect to the normal.
