#include <bits/stdc++.h>
using namespace std;
int n, m, A, B, S, sl, fh, a[200010], w[200010], inv[3010 << 1], f[3010][3010],
    g[3010][3010];
int rd() {
  sl = 0;
  fh = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') sl = sl * 10 + ch - '0', ch = getchar();
  return sl * fh;
}
int _pow(int k, int i) {
  int t = 1;
  while (i) {
    if (i & 1) t = 1ll * t * k % 998244353;
    k = 1ll * k * k % 998244353;
    i >>= 1;
  }
  return t;
}
int main() {
  n = rd();
  m = rd();
  for (int i = 1; i <= n; ++i) a[i] = rd();
  for (int i = 1; i <= n; ++i) {
    w[i] = rd();
    S += w[i];
    if (a[i])
      A += w[i];
    else
      B += w[i];
  }
  for (int i = 0; i <= m * 2; ++i) inv[i] = _pow(S + i - m, 998244353 - 2);
  for (int i = m; ~i; --i) {
    f[i][m - i] = g[i][m - i] = 1;
    for (int j = m - i - 1; ~j; --j)
      f[i][j] =
          (1ll * (A + i + 1) * f[i + 1][j] + 1ll * (B - j) * f[i][j + 1]) %
          998244353 * inv[i - j + m] % 998244353,
      g[i][j] =
          (1ll * (B - j - 1) * g[i][j + 1] + 1ll * (A + i) * g[i + 1][j]) %
          998244353 * inv[i - j + m] % 998244353;
  }
  A = f[0][0];
  B = g[0][0];
  for (int i = 1; i <= n; ++i)
    if (a[i])
      printf("%lld\n", 1ll * A * w[i] % 998244353);
    else
      printf("%lld\n", 1ll * B * w[i] % 998244353);
  return 0;
}
