My question is that I woke up for Fajar and turned off my alarm but something came I again slept...I don't know then again got up went to masjid there imam was in second rakat sitting...so he said salam . I prayed sunnah first then fard but one guy said your fard or sunnah are not accepted but when I left from home sun was already coming up so technically it was already when I arrived at the masjid...so would my salaah be okay because of the hadith that if you forget or sleep pray immediately.
If you have seen the Imam praying with the Jama'ah and he was sitting, then you could have joined the prayer, namely by sitting down too (if you had the time), and afterwards made the Sunnah prayer:
The one who misses the Sunnah prayer before Fajr may offer it after Fajr prayer. The evidence for that is the report narrated by At-Tirmidhi (422) and Abu Dawud (1267) from Qays ibn A'mr who said: The Messenger of Allah (ﷺ) came out when the I'qamah for prayer had been given, and I prayed Fajr with him, then the Prophet (ﷺ) finished and found me praying. He said: “Take it easy, O Qays, two prayers together?” I said: "O Messenger of Allah, I did not pray the two Rak’at before Fajr." He said: "No, then." According to the version narrated by Abu Dawud, the Messenger of Allah (ﷺ) remained silent.'
As I understand it, if you have seen the Jama'ah praying, and you did not pray with them, then how come you can be late or that you would have missed Fajr if you right after that prayed? Because the Jama‘a would not pray close to the sunrise.
“Whoever catches up with a rak’ah of the prayer, has caught up with the prayer.” Al-Bukhari (580)
And he (ﷺ) said: "Whoever catches up with a Rak'at of Fajr prayer before the sun rises has caught up with Fajr, and whoever catches up with a rak’ah of A'sr prayer before the sun sets, has caught up with A'sr." Al-Bukhari (579)
And, it is narrated:
"Whoever performs ablution and heads to the mosque and finds that the people had already prayed, Allah gives him the same reward as those who actually attended the prayer and this does not reduce the reward of those people (in anyway)." Narrated in Abu Dawud (564)