Answer
Spring will stretch more in the first case when the spring is attached to the wall.
Work Step by Step
Let say the force a single person exerts on the spring is $F$.
In the first condition when the spring is attached to the wall.
The two persons pulls the spring to the right with force $2F$. The wall also applies the same force on the other side i.e $2F$ in the opposite direction. So the tension in the spring is $2F$.
In the second condition when the spring is detached from the wall, one person pulls the spring in one direction with force $F$ and the other pulls in the other direction with same force $F$. Hence tension in this case would be $F$.
For a spring:
$$T = kx$$
So, more $T$ means more elongation.
Hence the spring will stretch more in the first condition.