I have a problem in which two carts are attached by a compressed spring. I have found that cart $A$ moves at $1.1~\mathrm{m/s}$ to the right and has a mass of $0.39 ~\textrm{kg}.$ Cart $B$ has a mass of $0.18~\textrm{kg}$ and moves at $2.382~\mathrm{m/s}$ in the opposite direction. How do I use the equation $U = kx^2$ to find what the potential elastic energy is?
It isn't making sense to me because I don't know what the displacement of each cart is.