We investigate theoretically an acoustic metasurface with a high absorption coefficient at two frequencies and design it from subwavelength structures. We propose the use of a two-dimensional periodic array of four Helmholtz resonators in two types to obtain a metasurface with nearly perfect sound absorption at given target frequencies via interactions between waves emanating from different resonators. By considering how fluid viscosity affects acoustic energy dissipation in the narrow necks of the Helmholtz resonators, we obtain effective complex-valued material properties that depend on frequency and on the geometrical parameters of the resonators. We furthermore derive the effective acoustic impedance of the metasurface from the effective material properties and calculate the absorption spectra from the theoretical model, which we compare with the spectra obtained from a finite-element simulation. As a practical application of the theoretical model, we derive empirical formulas for the geometrical parameters of a metasurface which would yield perfect absorption at a given frequency. While previous works on metasurfaces based on Helmholtz resonators aimed to absorb sound at single frequencies, we use optimization to design a metasurface composed of four different Helmholtz resonators to absorb sound at two distinct frequencies. Published by AIP Publishing.