Cart A has a mass of 10kg and is moving towards cart B at a speed of 15 m/s. If cart B is moving towards cart A with a speed of 5 m/s, what mass must Cart B have to stop both carts upon collision?

If A is moving in the positive direction, then we must have zero total momentum before and after the collision:

10(15) + m(-5) = 0