#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main() {
  int n, k, i, j;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  j = 0;
  long long s = 0;
  for (i = 0; i < k; i++) {
    while (j < n && a[j] <= s) j++;
    if (j >= n) {
      cout << 0 << endl;
      continue;
    }
    a[j] -= s;
    s += a[j];
    cout << a[j] << endl;
    j++;
  }
  return 0;
}
