A spring, a ramp, and a mass

A block of mass m is held at rest near the bottom of a frictionless incline. The block compresses a spring by a length X compared to its equilibrium length. The spring has spring constant k. When the block is released, it travels a distance d up the slope. What is d?

Assume that all the energy initially stored in the spring is transferred to the block.