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