#include <bits/stdc++.h>
using namespace std;
const int Maxn = 110000;
int n, k, a[Maxn];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int temp = 0, now = 1;
  for (int i = 1; i <= k; i++) {
    while (now != n && a[now] == temp) now++;
    printf("%d\n", a[now] - temp);
    temp = a[now];
  }
  return 0;
}
