  The scattering of electromagnetic wave by a periodic array of nanowires is
calculated by the boundary element method. The method is extended to the
infinite grating near the interface between two dielectrics. A special Green
function is derived that allows to study the evanescent wave. The Rayleigh---
Wood's anomalies are found in the period-to-wavelength dependence of the
average Pointing vector in the wave zone. For thin wires the calculations are
shown to agree with the two-dimensional coupled dipole approximation.
