Answer
Please see the work below.
Work Step by Step
We know that when a mass is placed on top of a vertical spring then the spring is compressed and the gravitational potential energy of the mass is converted into the potential energy of the spring and finally the mass comes to rest.