Finding the maximum displacement

Homework Statement

I want to find the maximum displacement of block A in the left direction

The Attempt at a Solution

I first found the velocities of both blocks after the bullet escapes with 100m/s by using the impulse-momentum theorem.
I then applied the work-energy theorem for the system
For a maximum displacement, I assumed that work done by internal dissipative forces must have been tending to zero. Solving, I got an answer much greater than the correct answer which means my assumption was wrong.

I don't know how to proceed further