Assuming that we can neglect the gravitational potential energy of the mass, and that no other forces acting on the payload, total mechanical energy must be conserved.
This energy, at any time, is part elastic potential energy (stored in the spring) and part kinetic energy.
When the spring is initially compressed, the payload is at rest, so all energy is elastic potential.
Once the spring has returned to its natural state, all this elastic potential energy must have been turned into kinetic energy.
If the payload is launched horizontally, and no gravity is present,this means that its final speed will be horizontal only also, according to Newton's First Law.
So, we can write the following equation:
where ΔU = -1/2*k*(Δx)² (2)
and ΔK = 1/2*m*v² (3)
Replacing in (2) and (3) by the givens, and simplifying, we can find the stiffness ks as follows: