The Prophet ﷺ gave the salam, then spoke, then performed the two prostrations of forgetfulness.
أخبرنا محمد بن آدم عن حفص عن الأعمش عن إبراهيم عن علقمة
أن النبي ﷺ سلم ثم تكلم ثم سجد سجدتي السهو
Reported by Muslim, Chapter on Mosques, section on forgetfulness in prayer and the sujud for it, no. 95/572, from the hadith of Hafs bin Ghiyath through this same route. It is also in Al-Kubra, no. 1252.