#include <bits/stdc++.h>
int v[1 + 200000];
int main() {
  FILE *fi, *fo;
  fi = stdin;
  fo = stdout;
  int n, k;
  fscanf(fi, "%d%d", &n, &k);
  for (int i = 1; i <= n; i++) fscanf(fi, "%d", &v[i]);
  std::sort(v + 1, v + n + 1);
  int i = 1;
  while (i <= n && v[i] == 0) i++;
  for (int j = 1; j <= k; j++) {
    while (i <= n && v[i] == v[i - 1]) i++;
    if (i <= n)
      fprintf(fo, "%d\n", v[i] - v[i - 1]);
    else
      fprintf(fo, "0\n");
    i++;
  }
  return 0;
}
