#include <bits/stdc++.h>
using namespace std;
int rdn() {
  int ret = 0;
  bool fx = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') fx = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') ret = ret * 10 + ch - '0', ch = getchar();
  return fx ? ret : -ret;
}
long long Mn(long long a, long long b) { return a < b ? a : b; }
const int N = 2e5 + 5, M = 3005, mod = 998244353;
int upt(int x) {
  while (x >= mod) x -= mod;
  while (x < 0) x += mod;
  return x;
}
int pw(int x, int k) {
  int ret = 1;
  while (k) {
    if (k & 1) ret = (long long)ret * x % mod;
    x = (long long)x * x % mod;
    k >>= 1;
  }
  return ret;
}
int n, m, a[N], w[N], f[M][M], g[M][M], iv[M * 2];
long long lm;
int main() {
  n = rdn();
  m = rdn();
  for (int i = 1; i <= n; i++) a[i] = rdn();
  int A = 0, B = 0;
  for (int i = 1; i <= n; i++) {
    w[i] = rdn() % mod;
    if (a[i])
      A = upt(A + w[i]);
    else
      B = upt(B + w[i]), lm += w[i];
  }
  for (int i = -m; i <= m; i++) iv[i + m] = pw(upt(A + B + i), mod - 2);
  for (int i = 0; i <= m; i++) f[i][m - i] = g[i][m - i] = 1;
  for (int s = m - 1; s >= 0; s--)
    for (int i = 0; i <= s; i++) {
      int j = s - i;
      if (j > lm) continue;
      int tp = iv[i - j + m];
      f[i][j] = ((long long)upt(A + i + 1) * f[i + 1][j] +
                 (long long)upt(B - j) * f[i][j + 1]) %
                mod;
      f[i][j] = (long long)f[i][j] * tp % mod;
      g[i][j] = ((long long)upt(B - j - 1) * g[i][j + 1] +
                 (long long)upt(A + i) * g[i + 1][j]) %
                mod;
      g[i][j] = (long long)g[i][j] * tp % mod;
    }
  for (int i = 1; i <= n; i++) {
    if (a[i])
      printf("%lld\n", (long long)w[i] * f[0][0] % mod);
    else
      printf("%lld\n", (long long)w[i] * g[0][0] % mod);
  }
  return 0;
}
