Change the observable frame of reference to the CM of the spaceship. Then, its velocity is 0, and its KE and P are both 0. After the explosion,

E = KE1 + KE2 = 1/2(M*v1^2 + m*v2^2)

P = 0 = M*v1 + m*v2

---

v1 = -m/M*v2

---

Solve for v1, v2 in terms of E, and answer is |v2 - v1|