#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, j, u, m = 0;
  cin >> n >> k;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (i = n - 1; i > 0; i--) a[i] = a[i] - a[i - 1];
  for (i = 0; i < n; i++) {
    if (a[i] != 0) {
      cout << a[i] << endl;
      m++;
      if (m == k) exit(0);
    }
  }
  for (i = 0; i < k - m; i++) cout << "0" << endl;
}
