Solve the following question given below:
Question: A 40 kg block is at rest on a frictionless horizontal surface and is attached to one end of a horizontal spring, which has a spring constant of 500 N/m. The other end of the spring is attached to a wall. Consider a 5 kg block traveling horizontally at 12 m/s, the block then strikes and sticks to the 40 kg block.
Part I: Find the maximum elastic potential energy stored in the spring after the collision?
I known the correct answer but I need to know how to get that. Thanks in advance!