Answer
$k = 4~N/m$
Work Step by Step
When all the energy in the system is in the form of kinetic energy, the kinetic energy is 8 J. Therefore, the total energy in the system is 8 J.
When the spring is stretched or compressed by 2 meters, all the energy in the system is in the form of potential energy. We can find the spring constant.
$U_s = E$
$\frac{1}{2}kA^2 = E$
$k = \frac{2E}{A^2}$
$k = \frac{(2)(8~J)}{(2~m)^2}$
$k = 4~N/m$