#include <cstdio>
#include <algorithm>
using namespace std;
pair <int,int> a[1004];
bool cmp  (pair<int,int> q1, pair<int,int> q2){
     return q1.second>q2.second;
}
int main (){
    int n,c,t;
    scanf ("%d%d",&n,&c);
    int br=0;
    for (int i=0;i<n;++i){
        scanf ("%d",&t);
        for (int j=0;j<br;++j){
            if (a[j].first==t){
               ++a[j].second;
               goto abc;
            }
        }
        a[br].first=t;
        a[br].second=1;
        ++br;
        abc:;
    }
    sort (a,a+br,cmp);
    for (int i=0;i<br;++i){
        while (a[i].second>0){
              printf ("%d ",a[i].first);
              --a[i].second;
        }
    }
    printf ("\n");
}
