In the arrangement shown in figure, cylinder is thermally insulated. An ideal gas is filled in the cylinder having pressure P0 (> atmospheric pressure Pa ). Spring of force constant k is initially unstretched. Piston of mass m and area S is frictionless. In equilibrium piston rises up a distance x0, then:

Know your College Admission Chances Based on your Rank/Percentile, Category and Home State.
Get your JEE Main Personalised Report with Top Predicted Colleges in JoSA

Final pressure = Pa +
Work done by gas
(thermally instated)