Take into account that the momentum must conserve before and after the collision.
Before the collision the total momentum is:
p1 and p2 have opposite signd because the carts are moving in opposite directions. If motions to the right is considered as positive, then, the previous negative result means that total momentum beofre the collision is to the left.
Now, after the collision you obtain:
v is the speed of the cart together after the collision. Due to the momentum must conserve, po = p, then by solving for v and replacing, you have:
the speed of the carts togueter is 2m/s and the direction of motion is to the left.