#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long int a, n, m;
  cin >> n >> m;
  set<long long int> s;
  while (n--) {
    cin >> a;
    s.insert(a);
  }
  set<long long int>::iterator it = s.begin();
  cout << *it << endl;
  while (--m) {
    if (next(it) == s.end())
      cout << 0 << endl;
    else {
      cout << *next(it) - *it << endl;
      it++;
    }
  }
}
