#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k, p = 1;
  cin >> n >> k;
  long long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  vector<long long> v;
  v.push_back(arr[0]);
  for (int i = 0; i < n - 1; i++) {
    if (arr[i] != arr[i + 1]) {
      v.push_back(arr[i + 1]);
    }
  }
  cout << v[0] << "\n";
  k--;
  while (k--) {
    if (p >= v.size()) {
      cout << 0 << "\n";
    } else {
      cout << v[p] - v[p - 1] << "\n";
      p++;
    }
  }
}
