#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  set<int> se;
  for (unsigned long long i = 0; i < n; i++) {
    int x;
    cin >> x;
    se.insert(x);
  }
  auto i = se.begin();
  se.erase(se.begin());
  k--;
  cout << *i << endl;
  int prev = *i;
  for (auto i : se) {
    if (k == 0) break;
    cout << i - prev << endl;
    prev = i;
    k--;
  }
  while (k--) cout << 0 << endl;
  return 0;
}
