#include<bits/stdc++.h>
#define int long long
using namespace std;
auto IN = freopen("qiju.in", "r", stdin);
auto OUT = freopen("qiju.out", "w", stdout);
auto mread = [](){int x;scanf("%lld", &x);return x;};
const int N = 2e5 + 5;
int n = mread(), m = mread(), a[N], sum[N];
bool check(int x, int mid){
// 要求最多 mid 个列大于等于 x
int p = lower_bound(a + 1, a + 1 + n, mid) - a;
return sum[p] - (n - p + 1) * mid <= (x - 1) * (m - mid);
}
signed main(){
for(int i = 1; i <= n; i ++){
cin >> a[i];
}
sort(a + 1, a + 1 + n);
for(int i = n; i >= 1; i --){
sum[i] = sum[i + 1] + a[i];
}
for(int i = 1; i <= n; i ++){
int l = 0, r = m;
while(l < r){
int mid = l + r >> 1;
if(check(i, mid)){
r = mid;
}
else{
l = mid + 1;
}
}
printf("%lld ", l);
}
return 0;
}