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