Imagine at the starting point the block held against the spring. You can find the initial potential energy of the system:
PE = (½) kx^2
PE = (½) (787 N/m) (0.12)^2
PE = 5.6664 J
Since at the starting point the spring is ideal and the surface is frictionless, all the potential energy at the starting point will be converted into kinetic energy of the starting block.
KEi = 5.6664 J
In the collision, since there are no forces on the system as the blocks collide, the energy will be conserved during the collision. Therefore, the initial kinetic energy of block A equals the sum of the kinetic energy of blocks A and B directly after the collision.
KEi = KE (block A) + KE (block B)
The kinetic energy of each block directly after the collision is equal to the energy lost as it stops, or in other words the work done to stop it. So:
KEi = W (block A) + W (block B)
To find the work done to stop each block, imagine the final resting point of the system after the blocks have slid on the rough surface and come to a stop. The smaller block (block B), will be 0.64 m in front of the larger block (block A).
You can then find the kinetic energy lost by each block by finding the work done on each block as it slides and comes to a stop.
W = F d cos (theta)
The force is the force of friction, which is opposite the direction of movement. So cos (theta) comes to -1. The force of friction is the normal force times the coefficient of friction, and d is the distance moved. So we end up with:
W = N (mu F) d
Work done on block A as it stops can then be found by substituting the given values:
W (block A) = N (mu F) d
W (block A) = (mass of block A) (g) (mu F) (distance travelled by block A)
W (block A) = (0.880 kg) (9.80m/s^2) (0.370) (distance travelled by block A)
W (block A) = 3.189 (distance travelled by block A) J
The work done on block B can be found in the same way:
W (block B) = (mass of block B) (g) (mu F) (distance travelled by block A + 0.64 m)
W (block B) = (0.530 kg)(9.80 m/s^2)(0.370)(distance travelled by A + 0.64 m)
W (block B) = 1.9218 (distance travelled by A + 0.64) J
Using the previous equation above:
KEi = W (block A) + W (block B)
5.666 J = (3.189)(distance travelled by block A) + 1.9218 (distance travelled by A + 0.64)
5.666 J = 3.189(distance travelled by A) + 1.9218(distance travelled by A) + 1.22995
4.436 = (3.189+ 1.1918) (distance travelled by A)
Distance travelled by A = 0.86 m
We can use this to find the initial kinetic energy of block B:
KE (block B) = 1.9218 (distance travelled by A + 0.64)
KE (block B) = 1.9218 (0.86 + 0.64)
KE (block B) = 4.8089
The initial velocity of block B can be found from the initial kinetic energy of block B:
KE = (½) (mass of block B) (velocity of block B)^2
4.8089 J = (½) (0.530)v^2
v = 4.26 m/s