When only the mass m2 is suspended let the elongation of the spring be x1. When both the masses (m2 + m1) together are suspended, the elongation of the spring is (x1 + x2). Thus, we have
where k is the spring constant
Hence m1g = kx2.
Thus, x2 is the elongation of the spring due to the mass m1 only. When the mass m1 is removed the mass m2 executes SHM with the amplitude x2.
Amplitude of vibration = x2 = m1g/k
Angular frequency