http://help.apple.com/imac/late-2015/#/apdbc13fd966
Charge the battery. Connect your Magic Keyboard or Magic Mouse 2 to your iMac with the included Lightning to USB cable. To check the charge level, click
in the menu bar at the top of the screen, then choose your device.
To charge the battery faster, be sure your input device is switched on when you connect it to your iMac.
For more information about the rechargeable batteries in your Magic Keyboard or Magic Mouse 2, go to Apple Lithium-ion Batteries.
And no - the battery stops charging when fully charged so you cannot "overcharge" it
Enjoy the iMac and please let us know of any questions