#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;

class br{
	public:
		long long broj;
		int brp;
		br(int a, int b){
			broj = a;
			brp = b;
		}
};

vector<br> b;

int n;
int c;

int u;
int br_sz;
int temp;

bool comp(br a1, br b1){
	if(a1.brp > b1.brp){
		return true;
	}
	else{
		return false;
	}
}

int main(void){

	cin>>n>>c;
	b.reserve(1000);
	for(int i = 0; i < n; ++i){
		cin>>u;
		temp = 0;
		br_sz = b.size();
		for(int j = 0; j < br_sz; ++j){
			if(b[j].broj == u){
				b[j].brp += 1;
				temp = 1;
			}
		}
		if(!temp){
			b.push_back(br::br(u, 1));
		}
	}
	
	stable_sort(b.begin(), b.end(), comp);
	for(int i = 0; i < br_sz; ++i){
		for(int j = 0; j < b[i].brp; ++j){
			cout<<b[i].broj<<" ";
		}
	}

	//cout<<endl;system("pause");
	return 0;
}
