عَنْ أَبِي هُرَيْرَةَ رَضيَ اللهُ عنهُ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ: «إِذَا انْتَهَى أَحَدُكُمْ إِلَى الْمَجْلِسِ فَلْيُسَلِّمْ، فَإِذَا أَرَادَ أَنْ يَقُومَ فَلْيُسَلِّمْ، فَلَيْسَتِ الْأُولَى بِأَحَقَّ مِنَ الْآخِرَةِ».
The Prophet (may Allah's peace and blessings be upon him) guided whoever comes to a gathering, where people are sitting, to greet the people with peace. Likewise, if he wants to leave, he should bid farewell to the people with peace as well, for the greeting upon arrival is not more deserving than the greeting upon departure.
Download for free and never miss a prayer again