#include<iostream>
#include<vector>
#include<cmath>
#include<iomanip>
#include <sstream>
#include<algorithm>
#include <cstdio>
#include<string>
int man[20001];
int ps(int s, int e, int v[]) {
int key = s;
while (s < e) {
while (s < e && v[e] >= v[key])
e--;
while (s < e && v[s] <= v[key])
s++;
std::swap(v[s], v[e]);
}
std::swap(v[s], v[key]);
return s;
}
void qs(int s, int e,int v[]) {
if (s >= e)
return;
else {
int key = ps(s, e, v);
qs(s, key - 1, v);
qs(key + 1, e, v);
}
}
int main() {
int n, m;
std::cin >> n>>m;
for (int i =0; i < m; i++) {
int choose;
std::cin >> man[i];
}
qs(0, m-1, man);
for (int i = 0; i <m; i++) {
std::cout << man[i] << " ";
}
}