To solve this problem it is necessary to apply the concepts related to the elastic potential energy and the difference that can exist when there are two compression states.
By definition the potential elastic energy is defined as

Where
k = Spring constant
x = Displacement
In our case we have two displacements and compression states therefore

When 6 millimeters is compressed, from the first millimeter that was compressed we can define that from the initial state 7mm was compressed

The change in potential energy can then be expressed as



Replacing with our values


Therefore the total energy required is 0.00624J