#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
typedef tuple<double, int, int> stick;
void cut(vector<stick> & t, int n)
{
sort(t.rbegin(), t.rend());
int initialMax = ceil (get<0>(t[0 ]));
int initialMin = floor(get<0>(t[n-1]));
int initialDifference = initialMax - initialMin;
// Try the longest stick
double cutval = (double) get<1>(t[0]) / (get<2>(t[0]) + 1);
int cutval = max(ceil (cutval), ceil (get<0>(t[1 ])));
int cutval = min(floor(cutval), floor(get<0>(t[n-1])));
int cutDifference = cutval - cutval;
int cutIndex = 0;
// Longest stick increased the difference.
// Try cutting one of the other sticks such that the difference remains constant
for (int i = 1; i < n; i++)
{
double newval = (double) get<1>(t[i]) / (get<2>(t[i]) + 1);
int newmax = max((int) ceil (newval), initialMax);
int newmin = min((int) floor(newval), initialMin);
int newDifference = newmax - newmin;
if (newDifference < cutDifference)
{
cutDifference = newDifference;
cutval = newval;
cutIndex = i;
}
}
cout << cutDifference << " ";
get<0>(t[cutIndex]) = cutval;
get<2>(t[cutIndex])++;
}
int main()
{
int n, m;
cin >> n >> m;
vector<stick> t;
for (int i = 0; i < n; i++)
{
int l;
cin >> l;
t.push_back(make_tuple(l, l, 1));
}
for (int i = 1; i <= m; i++)
{
cut(t, n);
}
}