Answer:
Part a)

Part b)

Step-by-step explanation:
As we know that two carts are moving in opposite directions
so here total momentum of two carts must be given by vector subtraction
It is given as



Now we know that total momentum of the system is conserved here as there is no external force on this system
so the speed of the first cart when second cart was at rest is given as


