The trick here is how you have to measure the distances.

The first piece of information tells you the spring constant.

The rest of it is all about how you define quantities in your system. For starters, there is no friction so the total mechanical energy is conserved.

Now we choose a coordinate system. My choice for the gravitational potential energy zero level is the point where the body is released. This will make all of your height measurements negative, but trust me, this is one of the better choices. (The other good choice is where the top of the spring is at the beginning of the problem.) Of course, for the spring potential energy the zero level is where the top of the relaxed spring is.

We have two problems that I would do independently. The first involves the total distance along the slope that the body slides. It starts from rest, so calling the distance along the slide d, we get that the body will drop a height

The object ends at rest as well, so we get:

Since we know x, we can solve this for d.

The second problem involves the speed when the body first contacts the spring. Note that the distance along the slide traveled by the body is going to be d - x, so the height at the point of first contact with the spring is going to be

where we can use the d from the solution to the first part.

So again, employing energy conservation:

which you can solve for v.

Notice carefully that the spring potential energy when the body is at its lowest position on the slide is NOT equal to the kinetic energy of the body when it strikes the spring. This is because the body has a change of gravitational potential energy as it is compressing the spring.

-Dan