When a spring is compressed, a force is exerted by its material to restore it to its equilibrium position and its force is called restoring force
Hooke's Law states the relationship between the restoring force and the displacement that is occurred to the spring and it is given by equation
where is the force constant and the negative sign shows the direction
so, he exerts a force in the negative sign of the restoring force is given by
Now, put the values