$S_2$ in first $p$ sec
$ \mathrm{S}_1=\frac{1}{2} \mathrm{a}(\mathrm{p}-1)^2 $
$ \mathrm{~S}_2=\frac{1}{2} \mathrm{a}(\mathrm{p})^2 $
$ \mathrm{~S}_1+\mathrm{S}_2=\frac{1}{2} \mathrm{at}^2 $
$ (\mathrm{p}-1)^2+\mathrm{p}^2=\mathrm{t}^2 $
$ \mathrm{t}=\sqrt{2 \mathrm{p}^2+1-2 \mathrm{p}}$