#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int val;
    cin >> val;
    if (mp.find(val) == mp.end()) {
      mp[val]++;
      a.push_back(val);
    }
  }
  sort(a.begin(), a.end());
  int i = 0, sum = 0;
  int g = a.size();
  while (i < min(g, k)) {
    int x = a[i] - sum;
    cout << x << endl;
    sum += x;
    i++;
  }
  while (i < k) {
    cout << "0" << endl;
    i++;
  }
  return 0;
}
