Turn the engine in the reverse direction it normally runs, by hand, it usually returns the pinion gear back home.
But it prolly will happen again.
If you remove the starter as suggested, investigate the worm shaft/overrunning clutch to see why it over traveled.