#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long x, a[N], b[N];
long long n, k;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + 1 + n);
  b[1] = a[1];
  int j = 2;
  for (int i = 2; i <= n; i++) {
    if (a[i] != a[i - 1]) {
      b[j] = a[i] - a[i - 1];
      j++;
    }
  }
  for (int i = 1; i <= k; i++) {
    cout << b[i] << "\n";
  }
}
