#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5020;
int a[MAXN];
bool f[MAXN];
int main()
{
// freopen("input.txt", "r", stdin);
freopen("round.in", "r", stdin);
//freopen("output.txt", "w", stdout);
freopen("round.out", "w", stdout);
int n, m;
cin >> n >> m;
int s = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i];
s += a[i];
}
int sum = 0;
for (int i = 0; i < n; ++i) {
// cout << fixed << (double) a[i] / s * m << ' ';
if (a[i] % s == 0)
f[i] = 1;
a[i] = ceil((double) a[i] / s * m);
sum += a[i];
}
// cout << endl;
// for (int i = 0; i < n; ++i)
// cout << a[i] << ' ';
// cout << endl;
int i = 0;
while (sum != m) {
if (!f[i]) {
a[i] -= 1;
sum -= 1;
}
++i;
}
for (i = 0; i < n; ++i)
cout << a[i] << ' ';
}
CiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBNQVhOID0gNTAyMDsKCmludCBhW01BWE5dOwpib29sIGZbTUFYTl07CgppbnQgbWFpbigpCnsKLy8gICAgZnJlb3BlbigiaW5wdXQudHh0IiwgInIiLCBzdGRpbik7CiAgICBmcmVvcGVuKCJyb3VuZC5pbiIsICJyIiwgc3RkaW4pOwogICAgLy9mcmVvcGVuKCJvdXRwdXQudHh0IiwgInciLCBzdGRvdXQpOwogICAgZnJlb3Blbigicm91bmQub3V0IiwgInciLCBzdGRvdXQpOwogICAgaW50IG4sIG07CiAgICBjaW4gPj4gbiA+PiBtOwogICAgaW50IHMgPSAwOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpIHsKICAgICAgICBjaW4gPj4gYVtpXTsKICAgICAgICBzICs9IGFbaV07CiAgICB9CiAgICBpbnQgc3VtID0gMDsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKSB7Ci8vICAgICAgICBjb3V0IDw8IGZpeGVkIDw8IChkb3VibGUpIGFbaV0gLyBzICogbSA8PCAnICc7CiAgICAgICAgaWYgKGFbaV0gJSBzID09IDApCiAgICAgICAgICAgIGZbaV0gPSAxOwoKICAgICAgICBhW2ldID0gY2VpbCgoZG91YmxlKSBhW2ldIC8gcyAqIG0pOwogICAgICAgIHN1bSArPSBhW2ldOwogICAgfQovLyAgICBjb3V0IDw8IGVuZGw7Ci8vICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKQovLyAgICAgICAgY291dCA8PCBhW2ldIDw8ICcgJzsKLy8gICAgY291dCA8PCBlbmRsOwogICAgaW50IGkgPSAwOwogICAgd2hpbGUgKHN1bSAhPSBtKSB7CiAgICAgICAgaWYgKCFmW2ldKSB7CiAgICAgICAgICAgIGFbaV0gLT0gMTsKICAgICAgICAgICAgc3VtIC09IDE7CiAgICAgICAgfQogICAgICAgICsraTsKICAgIH0KICAgIGZvciAoaSA9IDA7IGkgPCBuOyArK2kpCiAgICAgICAgY291dCA8PCBhW2ldIDw8ICcgJzsKfQo=