A 25 kg block is connected to a 30 kg block by a light string that passes over a frictionless pulley. The 30 kg block is connected to a light spring of force constant 195 N/m, as in Figure P13.59. The spring is unstretched when the system is as shown in the figure, and the incline is smooth. The 25 kg block is pulled 15 cm down the incline (so that the 30 kg block is 35 cm above the floor) and is released from rest. Find the speed of each block when the 30 kg block is 20 cm above the floor (that is, when the spring is unstretched).

I wrote out all the equations
For the 25kg mass
$$\sum F_x = T- mg\sin\theta = ma$$
$$\sum F_y = n = mg\cos\theta$$
For the 30kg mass
$$\sum F_y = kx + Mg - T = Ma$$
Using energy, I got v = 0.91m/s, but using Newton's Law I got 0.95m/s
EDIT:
Energy
$E = Mgh + \frac{1}{2}kh^2$
$E' = mgh\sin\theta + \frac{(M + m)}{2}v^2$
$E = E'$
Solving, $v = \sqrt{\frac{2Mgh + kh^2 - mgh\sin\theta}{m + M}}$
Forces
$T- mg\sin\theta = ma$
$kh + Mg - T = Ma$
Add the two equations
$kx + g(M - m\sin\theta) = (M + m)a$
$\frac{kh + g(M - m\sin\theta)}{M + m} = a$
$v^2 = 2\frac{kh + g(M - m\sin\theta)}{M + m}h$
$v = \sqrt{2\frac{kh + g(M - m\sin\theta)}{M + m}h}$
The source of the mistake seem to lie with the 2 in front of the kh
