#include <bits/stdc++.h>
using namespace std;
char mov_y[] = {1, -1, 0, 0};
char mov_x[] = {0, 0, 1, -1};
int coin[5] = {100, 20, 10, 5, 1};
long long n, k;
long long Ok(long long x, long long y) { return x > y; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(6);
  int min_val, prev = -1, cur = 0;
  cin >> n >> k;
  vector<int> ve;
  vector<int>::iterator it;
  for (int i = 0; i < n; i++) {
    int val;
    cin >> val;
    ve.push_back(val);
  }
  sort(ve.begin(), ve.end());
  for (int i = 0; i < ve.size(); i++) {
    if (k == 0) break;
    if (ve[i] != prev) {
      prev = ve[i];
      cout << ve[i] - cur << endl;
      cur = ve[i];
      k--;
    }
  }
  for (int i = 0; i < k; i++) cout << 0 << endl;
  return 0;
}
