#include <bits/stdc++.h>
using namespace std;
int A[100005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  int N, K;
  cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> A[i];
  sort(A + 1, A + 1 + N);
  int ptr = 1, done = 0;
  for (int i = 1; i <= K; i++) {
    while (ptr <= N && A[ptr] == done) ptr++;
    if (ptr > N)
      cout << 0 << "\n";
    else {
      cout << A[ptr] - done << "\n";
      done = A[ptr];
    }
  }
  return 0;
}
