Use energy balance to get the final speed of the first cart: potential energy before --> kinetic energy after

mgh = 1/2 mv^{2} and solve for v

Next, you have an inelastic collision: momentum is conserved:

m_{1}v_{1} = (m_{1}+m_{2}) v_{12} where v_{12} is the velocity of the two carts stuck together.(solve for v_{12})

Finally, all of the kinetic energy of of the two carts is dissipated by "frictional work."

1/2(m_{1} + m_{2})v_{12}^{2} = F_{f}d = (m_{1} + m_{2})gμd Solve for μ and note that the masses cancel.

good luck!