Allah tells them how much they wasted in their short lives in this world by failing to obey Allah and worship Him Alone.

If they had been patient during their short stay in this world, they would have attained victory just like His pious close friends.

﴿قَـلَ كَمْ لَبِثْتُمْ فِى الاٌّرْضِ عَدَدَ سِنِينَ ﴾

(He will say: "What number of years did you stay on earth'') means, how long did you stay in this world

﴿قَالُواْ لَبِثْنَا يَوْماً أَوْ بَعْضَ يَوْمٍ فَاسْأَلِ الْعَآدِّينَ ﴾

(They will say: "We stayed a day or part of a day. Ask of those who keep account.'') meaning, those who keep the records.

﴿قَالَ إِن لَّبِثْتُمْ إِلاَّ قَلِيلاً﴾

(He will say: "You stayed not but a little...'') meaning, it was only a short time, no matter how you look at it.

﴿لَّوْ أَنَّكُمْ كُنتُمْ تَعْلَمُونَ﴾

(if you had only known!) means, you would not have preferred the transient to the eternal, and treated yourself in this bad way, and earned the wrath of Allah in this short period. If you had patiently obeyed Allah and worshipped Him as the believers did, you would have attained victory just as they did.