#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>
#include <algorithm>

using namespace std;

map <int,int> a;
pair <int,int> b[1000];
int n,c;

int stri(pair <int,int> x,pair <int,int> z){
    return x.second>z.second;
    }


int main(){
    scanf("%d%d",&n,&c);
    for(int k=0;k<n;k++){scanf("%d",&b[k].first);a[b[k].first]++;}
    for(int k=0;k<n;k++)b[k].second=a[b[k].first];
    sort(b,b+n,stri);
    for(int k=0;k<n;k++){
            for(int i=0;i<a[b[k].first];i++)printf("%d ",b[k].first);
            a[b[k].first]=0;
            }
    printf("\n"); //system("pause");
    return 0;
    }
