[单选题]
A metal ball of mass $m$ is released from a height of $h$ above a massless platform attached to a vertical spring.
The spring constant of the spring is given by $\frac{mg}{h}$. The ball hits the spring and compresses it. When the spring is compressed by a distance $h$, what is the speed of the ball?(Energy transfer only happens between spring and ball and the kinetic energy of the spring can be ignored)
A. $\sqrt{2h}$
B. $\sqrt{2gh}$
C. $\sqrt{3h}$
D. $\sqrt{3gh}$