Sayyidina Abu Huraira (RA) reported that a man came into the mosque while Allah’s Messenger (SAW) was sitting at a side. He offered his salah and offered salaam to Allah’s Messenger (SAW) He responded with, “Wa alayk (and on you). Go back and pray, for you have not prayd.” Then he reported the full hadith.
[Bukhari 6251]