The Latecomer should not take into Account the (unintentional) Addition made by the Imam in Prayer
Question :
A man entered the prayer with the congregation and he prayed one Rak'ah with the Imam, then the Imam made the prostration of forgetfulness and made the Taslim. While he was making up what he missed of the prayer, he came to know that the Imam had prayed an extra Rak'ah. So was it permissible for this man to count that extra Rak'ah (which the Imam prayed), or should he have started the prayer from the beginning, without counting that extra Rak'ah which the Imam prayed?
Answer:
If the Imam prayed an extra Rak'ah due to forgetfulness, it is upon the latecomer not to count it. This is because it was prayed due to a mistake by the Imam, according to the most authoritative of two opinions held by the scholars. So he should perform the whole prayer and make the prostration of forgetfulness after completing what he had missed, if he did not do so with the Imam; but if he prostrated with the Imam, that is enough for him. And Allah is the Granter of success.
Source:
Ibn Baz
Fatawa Islamiyah, Vol. 2 Pages 242-243