A latecomer (Masbuq) must perform Sujud al-Sahw with the Imam, even if the Imam's mistake occurred before the latecomer joined the congregation.

Prostration of Forgetfulness: Specialized & Congregational Cases