Dynamic beam steering with reconfigurable metagratings