#include <bits/stdc++.h>
using namespace std;
long long a[100001];
long long n, k;
int main() {
  long long p = 0, no = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  p = 0;
  for (int i = 0; i < n; i++) {
    if (p != a[i]) {
      no++;
      cout << a[i] - p << endl;
    }
    p = a[i];
    if (no == k) break;
  }
  for (int i = 0; i < (k - no); i++) cout << "0" << endl;
  return 0;
}
