Use energy balance to get the final speed of the first cart: potential energy before --> kinetic energy after
mgh = 1/2 mv2 and solve for v
Next, you have an inelastic collision: momentum is conserved:
m1v1 = (m1+m2) v12 where v12 is the velocity of the two carts stuck together.(solve for v12)
Finally, all of the kinetic energy of of the two carts is dissipated by "frictional work."
1/2(m1 + m2)v122 = Ffd = (m1 + m2)gμd Solve for μ and note that the masses cancel.
good luck!