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