So after $4$ oscillations of pendulum $A$ i.e. after $5 T$, pendulum $B$ leads by $2 \pi$ i.e they come in phase.
i.e. after $5$ oscillations of small pendulum (Time taken $=5 T$ ), they will again come in the same phase.
${y_1} = 8\,\cos\, \omega t;\,{y_2} = 4\,\cos \,\left( {\omega t + \frac{\pi }{2}} \right)$ ;
${y_3} = 2\cos \,\left( {\omega t + \pi } \right);\,{y_4} = \,\cos \,\left( {\omega t + \frac{{3\pi }}{2}} \right)$ ,
are superposed on each other. The resulting amplitude and phase are respectively;