asumme block b moves down by distance x block a moves by same distance x,then angle made by spring wid da vertical is # extension inspring would be l* (sec# - 1) l is natural length .block a loses contact wid da spring when kxcos# = mg .now try it u wil get it .dis is forces method we can do it even by work-energy method