#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#include <bits/ranges_algo.h>
using namespace std;
int sumArr(vector<int> arr) {
int r = 0;
for (int i = 0; i < arr.size(); i++) {
r += arr[i];
}
return r;
}
int solve(vector<vector<int>> v, int n, int k, int mn) {
for (int i = 0; i < k; i++) {
vector<int> v1 = v[v.size()-1];
int parent = sumArr(v1);
int divider = v1.size();
v.pop_back();
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);
}
v.push_back(temp);
sort(v.begin(), v.end());
int mx = v[v.size()-1][0];
cout << mx - mn << " ";
}
}
int main() {
int n,k ;
int mn = INT_MAX;
cin >> n >> k;
vector<vector<int>> v;
for (int i = 0; i < n; i++) {
vector<int> temp;
int a;
cin >> a;
temp.push_back(a);
if (temp[0] < mn) {
mn = temp[0];
}
v.push_back(temp);
}
sort(v.begin(), v.end());
solve(v, n, k, mn);
return 0;
}