Hello, Cathathome.
Sorry to hear you'r having this problem with your iMac.
If the computer is still powered on and stuck at this point, you can power it off by pressing the power button until the machine shuts off.
Next, do this: Reset the NVRAM on your Mac - Apple Support.
This is best done with a wired USB keyboard if available, but your wireless should do as well.
How to reset NVRAM - Option-Command⌘-P-R
Shut down your Mac, then turn it on and immediately press and hold these four keys together: Option, Command, P, and R. You can release the keys after about 20 seconds, during which your Mac might appear to restart.
If the problem resolves, then you are done.
If not, then you could try a reset of the SMC:
How to reset the SMC of your Mac - Apple Support