import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] count = new int[n+1];
int[] sortedVotes = new int[m];
// 统计每个数字出现的次数
for (int i = 0; i < m; i++) {
int vote = sc.nextInt();
count[vote]++;
}
// 将排序后的结果存储在sortedVotes数组中
int index = 0;
for (int i = 1; i <= n; i++) {
while (count[i] > 0) {
sortedVotes[index++] = i;
count[i]--;
}
}
// 一次性输出所有排序后的结果
for (int i = 0; i < m; i++) {
System.out.print(sortedVotes[i] + (i < m - 1 ? " " : "\n"));
}
}
}