#include <bits/stdc++.h>
#define INF INT32_MAX/2 + 1;
using namespace std;
int N, M;
vector<int> S;
pair<int, int> solve_minmax(vector<int> pieces, vector<int> m, int global_min) {
// returns the index of the piece to cut, and returns the new difference
int minmax = 0;
int max_index, max_value;
for (int i = 0; i < N; i++) {
if (m[i] > m[minmax]) minmax = i;
}
// find max_value among the sticks after we minimize max.
max_index = (minmax == 0) ? 1 : 0;
max_value = (S[minmax]-1)/(pieces[minmax]+1) + 1;
for (int i = 0; i < N; i++) {
if (i == minmax) continue;
if (m[i] >= m[max_index] and m[i] > max_value) {
max_index = i;
max_value = m[max_index];
}
}
return {minmax, max_value - min(global_min, S[minmax]/(pieces[minmax]+1))};
}
pair<int, int> solve_maxmin(vector<int> pieces, vector<int> m, int global_min) {
// returns the index of the piece to cut, and returns the new difference
int maxmin = 0;
int max_index, max_value;
for (int i = 0; i < N; i++) {
if (m[i] > m[maxmin]) maxmin = i;
}
// find max_value among the sticks after we minimize max.
max_index = (maxmin == 0) ? 1 : 0;
max_value = (S[maxmin]-1)/(pieces[maxmin]+1) + 1;
for (int i = 0; i < N; i++) {
if (i == maxmin) continue;
if (m[i] >= m[max_index] and m[i] > max_value) {
max_index = i;
max_value = m[max_index];
}
}
return {maxmin, max_value - min(global_min, S[maxmin]/(pieces[maxmin]+1))};
}
int main() {
int N, M;
cin >> N >> M;
int a;
vector<int> pieces(N, 1);
vector<int> m(N);
for (int _ = 0; _ < N; _++) {
cin >> a;
S.push_back(a);
}
sort(S.rbegin(), S.rend());
int global_min = S.back();
for (int i = 0; i < N; i++) m[i]=S[i];
//for (auto i: s) cout << i << " ";cout << endl;
int max_index, max_value, minmax, maxmin, d1, d2;
for (int k = 1; k <= M; k++) {
auto s = solve_minmax(pieces, m, global_min);
minmax = s.first; d1 = s.second;
auto s = solve_maxmin(pieces, m, global_min);
maxmin = s.first; d2 = s.second;
if (d1 > d2) {
cout << d2 << " ";
minmax = maxmin;
} else cout << d1 << " ";
// cut the piece
pieces[minmax]++;
m[minmax] = (S[minmax]-1)/pieces[minmax] + 1;
global_min = min(global_min, S[minmax]/pieces[minmax]);
}
cout << "\n";
}