As the surface is horizontal, the only change in energy will be the change in kinetic energy, as the box comes to an stop after compressing the spring.
As we know that the surface is frictionless also, this change in kinetic energy must be equal to the change in the elastic potential energy of the spring.
So we can write the following equality:
where
and
Simplifying and replacing by the values, we get:
Solving for k:
k = 3594.7 N/m
b)
For this part, we can just apply the same equality, replacing the value of k by the one we got, and solving for the initial speed v: