#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int MAX = 1000005;
long long modexp(long long x, long long n) {
  if (n == 0) return 1LL;
  if (n % 2 == 0) {
    long long y = modexp(x, n / 2) % mod;
    return (y * y) % mod;
  }
  return (x * modexp(x, n - 1) % mod) % mod;
}
long long fin(long long arr[], long long n) {
  long long low = 0, high = n, mid;
  while (low <= high) {
    mid = low + ((high - low) / 2);
    if (arr[mid] == 0) {
      low = mid + 1;
    } else {
      high = mid;
    }
  }
  return arr[mid];
}
int main() {
  long long t, n, i, sum, j, k, ans, z, g, q, cnt, mx = 0, pos, mn, low, high,
                                                   mid, val;
  cin >> n >> k;
  long long a[n], b[n];
  set<long long> st;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    st.insert(a[i]);
  }
  set<long long>::iterator it;
  pos = 0;
  sum = 0;
  for (it = st.begin(); it != st.end(); it++) {
    ans = (*it) - sum;
    sum = sum + ans;
    b[pos] = ans;
    pos++;
  }
  for (i = 0; i < k; i++) {
    if ((i < st.size()) && (b[i] > 0))
      cout << b[i] << endl;
    else
      cout << "0" << endl;
  }
  return 0;
}
