Once the applied force is removed the total mechanical energy of the system is constant and, at every point in time, is always equal to the sum of ball 1's kinetic energy plus ball 2's kinetic energy plus the potential energy of the spring.
The total mechanical energy the system has after the applied force is turned off depends only on the applied force and does not depend on what the two masses are set to.
Because the force is applied to ball 1, the total mechanical energy the system has after the force is removed depends much more on the mass of ball 1 than it does on the mass of ball 2.
If the applied force is
unchanged, increasing the total mass of the system will increase the total mechanical energy the system has after the applied force is turned off