Also forgot to mention... you have an inelastic collision where two masses have momentum.! Remember that there is a release of energy in the form of heat because of the collision. I think that's the key for you to plug the formula as mentioned above.
However that guy who said w is work WRONG WRONG WRONG
W is the Wahrscheinlichkeit, the frequency of occurrence of a macrostate or, more precisely, the number of possible microstates corresponding to the macroscopic state of a system — number of (unobservable) "ways" in the (observable) thermodynamic state of a system can be realized by assigning different positions and momenta to the various molecules.
I know this because I just did a test on classical thermodynamics at uni ! =)
hope this helps you