Metasurface Design Using Electromagnetic Inversion