#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, i, m, s = 0;
  cin >> n >> k;
  vector<long long> v;
  map<long long, long long> mp;
  for (i = 0; i < n; i++) {
    cin >> m;
    mp[m]++;
    if (mp[m] == 1) {
      v.push_back(m);
    }
  }
  sort(v.begin(), v.end());
  for (i = 0; i < k; i++) {
    if (i >= v.size()) {
      cout << 0 << endl;
      continue;
    }
    cout << v[i] - s << endl;
    s = v[i];
  }
}
