The Messenger of Allah ﷺ said, "When one of you arrives and the imam has already come out, let him pray two rakahs."Shuba said, "On Friday."
أخبرنا محمد بن عبد الأعلى قال حدثنا خالد قال حدثنا شعبة عن عمرو بن دينار قال سمعت
إن رسول الله ﷺ قال إذا جاء أحدكم وقد خرج الإمام فليصل ركعتين قال شعبة يوم الجمعة
Bukhari narrated it in "Tahajjud," in the chapter on what has been said about performing voluntary prayers two units at a time, hadith no. 1166, and Muslim narrated it in "Friday Prayer," in the chapter on greeting the mosque while the imam is delivering the sermon, hadith no. 57/875, from the hadith of Shubah with this wording, and it is also found in Al-Kubra, hadith no. 1703.