#include using namespace std; int main() { int N; long long M; cin >> N >> M; vector W( N ); long long mm = 0; for( int i = 0; i < N; i++ ) { cin >> W[i]; mm += W[i]; } vector ans( N ); long long s = 0; for( int i = 0; i < N; i++ ) { ans[i] = W[i] * M / mm; s += ans[i]; } int d = M - s; typedef pair P; vector

v( N ); for( int i = 0; i < N; i++ ) { v[i] = P( ans[i] * mm - W[i] * M, i ); } sort( v.begin(), v.end() ); for( int i = 0; i < d; i++ ) { int j = v[i].second; ans[j]++; } for( int i = 0; i < N; i++ ) { if( i ) cout << " "; cout << ans[i]; } cout << endl; }