#include using namespace std; long long gcd(long long a,long long b) { if(a == 0 || b == 0) { return max(a,b); } if(a % b == 0) { return b; } else { return gcd(b,a % b); } } int main() { int N,M; cin >> N >> M; long long sum = 0; vectorW(N); for(int i = 0; i < N; i++) { cin >> W[i]; sum += W[i]; } long long g = gcd(sum,M); if(g) { sum /= g; M /= g; } for(int i = 0; i < N; i++) { cout << (sum == 0?0:W[i]/sum*M) << ((i+1 == N)?"\n":" "); } }