A body moving with a kinetic energy of 20 J on a horizontal frictionless surface hits spring whose one end is fixed to a rigid wall and it compresses the spring and it comes to rest. What is the potential energy of spring when it is compressed to the maximum?