The potential energy of a spring depends on the displacement 'x' and the spring constant 'K'.
A plot of potential energy and kinetic energy versus displacement x for a block attached to a spring obeying Hooke's law is