Consider two bodies of same mass A and B kept at rest in contact with each other. Body A exerts force $F$ on body B which is accelerated to velocity $v$ by expending its energy by $K$ units. A reaction force $-F$ acts on A, and since it has same mass, it also gains kinetic energy $K$ as it moves with velocity $v$ in the opposite direction. So, the total energy of the system is the sum of energies of A and B or, $2K$. If the energy $K$ that A expended was given from outside, an extra $K$ amount of energy is present due to the reaction force. This is contradictory and violates the law of conservation of energy, though momentum is conserved.

Where am I wrong?

**Clarification:**

After reading the answers, I arrived at the conclusion that if A had some potential energy $K$ which is converted to kinetic energy, then both A and B will have equal shares of the energy, i.e., $\frac{K}{2}$. Is this understanding correct?