#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7, M = 3e3 + 7, mod = 998244353;
int f[M * 2], d[M][M], n, m, i, j, k, a[N], b[N], s[2], s0, s1, b0, b1;
long long pow_mod(long long x, long long n) {
  x = (x % mod + mod) % mod;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  for (scanf("%d%d", &n, &m), i = 1; i <= n; ++i) scanf("%d", a + i);
  for (i = 1; i <= n; ++i) scanf("%d", b + i), s[a[i]] += b[i];
  for (i = -m; i <= m; ++i) f[i + m] = pow_mod(s[0] + s[1] + i, mod - 2);
  d[0][0] = 1;
  for (i = 0; i < m; ++i)
    for (j = 0; j <= i; ++j)
      if (d[i][j]) {
        k = f[2 * j - i + m];
        d[i + 1][j] =
            (d[i + 1][j] + 1LL * (s[0] - (i - j)) * k % mod * d[i][j] % mod) %
            mod;
        d[i + 1][j + 1] =
            (d[i + 1][j + 1] + 1LL * (s[1] + j) * k % mod * d[i][j] % mod) %
            mod;
      }
  s0 = pow_mod(s[0], mod - 2);
  s1 = pow_mod(s[1], mod - 2);
  for (i = 0; i <= m; ++i) {
    b0 = (b0 + 1LL * i * d[m][m - i]) % mod;
    b1 = (b1 + 1LL * i * d[m][i]) % mod;
  }
  b0 = (mod - b0) % mod;
  for (i = 1; i <= n; ++i)
    printf("%lld\n", a[i] == 0
                         ? (b[i] + 1LL * b[i] * s0 % mod * b0 % mod) % mod
                         : (b[i] + 1LL * b[i] * s1 % mod * b1 % mod) % mod);
}
