Answer:
In an elastic collision, the momentum and the kinetic energies are conserved.
Momentum:

Kinetic energy:

We have two equations and two unknowns:

Step-by-step explanation:
The first cart hits the second cart at rest and turns back with half its speed.
The second cart starts moving to the right with half the initial speed of the first cart.