local mfl, mce = math.floor, math.ceil local function getgcd(x, y) while 0 < x do x, y = y % x, x end return y end local n, m = io.read("*n", "*n") local w = {} local wsum = 0 for i = 1, n do w[i] = io.read("*n") wsum = wsum + w[i] end if wsum == 0 then for i = 1, n do io.write(0) io.write(i == n and "\n" or " ") end os.exit() end local t = {} for i = 1, n do local gcd = getgcd(w[i], wsum) local a, b = mfl(w[i] / gcd), mfl(wsum / gcd) t[i] = a * mfl(m / b) end print(table.concat(t, " "))