Let x be the distance to which the spring is stretched. Then the net force exerted on the mass is
[tex]F(x) = 20\,\mathrm N - \left(40\dfrac{\rm N}{\rm m}\right) x[/tex]
Then the total work performed on the mass as it's stretched to 0.25 m from equilibrium position is
[tex]\displaystyle \int_0^{0.25\,\rm m} \left(20\,\mathrm N - \left(40\dfrac{\rm N}{\rm m}\right)x\right) \,\mathrm dx = 3.75 \,\mathrm J[/tex]
By the work-energy theorem, the total work done on the mass is equal to its change in kinetic energy. The mass starts at rest and is accelerated by the 20 N force to a speed v such that
[tex]W_{\rm total} = \Delta K \\\\ 3.75\,\mathrm J = \dfrac12(0.5\,\mathrm{kg})v^2[/tex]
Solve for v :
[tex]3.75\,\mathrm J = \dfrac12(0.5\,\mathrm{kg}) v^2 \\\\ v^2 = \dfrac{3.75\,\rm J}{0.25\,\rm kg} \\\\ v = \sqrt{\dfrac{3.75\,\rm J}{0.25\,\rm kg}} \approx \boxed{3.87\dfrac{\rm m}{\rm s}}[/tex]