As there is no external force, so displacement of centre of mass of the cart + boy system parallel to the surface is zero.
∆xcm=(m1∆x1+m1∆x1) / (m1+m2)
0=(m1∆x1+m1∆x1) / (m1+m2)
Let the boy moves towards the wall a distance 10 m and the cart moves away from the wall a distance x so,
displacement of man wrt ground towards the wall is ∆x1=10-x
displacement of cart wrt ground towards the wall is ∆x2=-x
m1∆x1+m1∆x1=0
20(10-x)+80(-x)=0
100x=200
x=2m
displacement of man wrt ground towards the wall is ∆x1=10-2=8m
Hence, the final distance of the boy from the wall will be X=25-8=17m