The mechanical energy is defined as the sum of the potential energy and the kinetic energy, then we have:
where K is the kinetic energy and U is the potential energy.
Plugging the values given for the mechanical and potential energy and solving for the kinetic energy we have that:
Therefore 40 J are kinetic energy.