#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main() {
int n, m;
int mn = INT_MAX;
int mx = 0;
// Input 2 numbers
cin >> n >> m;
// Create a multiset called mlt
multiset<vector<int> > mlt;
// Create an integer list
vector<int> v(n);
// Input list
for (int i = 0; i < n; i++) {
cin >> v[i];
mlt.insert({v[i], v[i]}); // Current number, parent
if (v[i] > mx) {
mx = v[i];
}
if (v[i] < mn) {
mn = v[i];
}
}
for (int i = 0; i < m; i++) {
auto last = *(--mlt.end());
// Set parent and divider
int parent = last.back();
int divider = last.size() - 1;
// Delete
mlt.erase(--mlt.end());
// Insert
divider++;
vector<int> temp(parent % divider, (parent / divider) + 1);
vector <int> temp2(divider - (parent % divider), (parent / divider));
if ((parent / divider) < mn) {
mn = parent / divider;
}
for (int u : temp2) {
temp.push_back(u);
}
temp.push_back(parent);
mlt.insert(temp);
// Get the difference between max and min
auto first = *mlt.begin();
last = *(--mlt.end());
mx = last[0];
int diff = mx - mn;
// Print difference
cout << diff << ' ';
}
return 0;
}