«صل الصلاة لوقتها فإن أدركت الإمام يصلي بهم فصل معهم وقد أحرزت صلاتك وإلا فهي نافلة لك»
The Prophet (peace and blessings be upon him) said:
"Pray the prayer at its proper time. Then, if you find the imam leading the people in prayer, pray with them (as well). Your (first) prayer has already been secured for you, and otherwise this (second prayer) will be a voluntary prayer for you."
Hadith Referenceصحیح الجامع الصغیر / حرف الصاد / 3770