Let xA be displacement of A and
xB be displacement of B.
For B to catch A, xA in t s must be equal to xB in (t−5) s
Using s=ut+12at2 for A and putting values,
xA=12(2)t2
Using s=ut+12at2 for B and putting values,
xB=20(t−5)
Now,
xA=xB
t2=20(t−5)
⇒t2−20t+100=0
⇒t=20±√400−4002
⇒t=10 s