#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, i, j, a, b;
  vector<long long> v;
  map<long long, long long> mp;
  scanf("%lld %lld", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%lld", &a);
    mp[a]++;
    if (mp[a] == 1) v.push_back(a);
  }
  sort(v.begin(), v.end());
  long long s = v.size();
  a = 0;
  for (i = 0, j = 0; i < k; i++) {
    b = 0;
    for (; j < s;) {
      if (v[j]) {
        b = v[j] - a;
        a += b;
        j++;
        break;
      }
      j++;
    }
    cout << b << endl;
  }
  return 0;
}
