#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5020;
int a[MAXN];
int main()
{
int n, m;
cin >> n >> m;
double 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) {
a[i] = ceil(a[i] / s * m);
sum += a[i];
}
int i = 0;
while (sum != m) {
a[i] -= 1;
sum -= 1;
++i;
}
for (int i = 0; i < n; ++i)
cout << a[i] << ' ';
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1BWE4gPSA1MDIwOwoKaW50IGFbTUFYTl07CgppbnQgbWFpbigpCnsKICAgIGludCBuLCBtOwogICAgY2luID4+IG4gPj4gbTsKICAgIGRvdWJsZSBzID0gMDsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKSB7CiAgICAgICAgY2luID4+IGFbaV07CiAgICAgICAgcyArPSBhW2ldOwogICAgfQogICAgaW50IHN1bSA9IDA7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgICAgIGFbaV0gPSBjZWlsKGFbaV0gLyBzICogbSk7CiAgICAgICAgc3VtICs9IGFbaV07CiAgICB9CiAgICBpbnQgaSA9IDA7CiAgICB3aGlsZSAoc3VtICE9IG0pIHsKICAgICAgICBhW2ldIC09IDE7CiAgICAgICAgc3VtIC09IDE7CiAgICAgICAgKytpOwogICAgfQogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpCiAgICAJY291dCA8PCBhW2ldIDw8ICcgJzsKfQo=