#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N, K;
  cin >> N >> K;
  int arr[N];
  for (int i = 0; i < N; i++) cin >> arr[i];
  sort(arr, arr + N);
  int sum = 0;
  for (int i = 0, j = 0; i < K; i++, j++) {
    if (j >= N)
      cout << 0 << endl;
    else {
      while (j < N && arr[j] - sum <= 0) j++;
      if (j == N)
        cout << 0 << endl;
      else {
        cout << arr[j] - sum << endl;
        sum = arr[j];
      }
    }
  }
  return 0;
}
