#include <bits/stdc++.h>
using namespace std;
inline int qpower(int x, int k) {
  int ans = 1;
  for (; k; k >>= 1, x = 1ll * x * x % 998244353)
    if (k & 1) ans = 1ll * ans * x % 998244353;
  return ans;
}
int inv[3030 << 1];
inline int getint() {
  char c = getchar();
  int x = 0;
  bool p = 0;
  while ((c > '9' || c < '0') && c != '-') c = getchar();
  if (c == '-') p = 1, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  if (p) x = -x;
  return x;
}
int n, m, a[200020], w[200020], sw, sw0, f[3030][3030 << 1], g[3030][3030 << 1];
inline int calc0(int i, int j) {
  int &dp = f[i][j];
  if (~dp) return dp;
  if (!i) return dp = 1;
  dp = 0;
  int swn = sw + j - m, sw0n = sw0 - (m - i - (j - m)) / 2, sw1n = swn - sw0n;
  dp = (dp + 1ll * sw1n * inv[j] % 998244353 * calc0(i - 1, j + 1)) % 998244353;
  dp = (dp + 1ll * (sw0n - 1) * inv[j] % 998244353 * calc0(i - 1, j - 1)) %
       998244353;
  return dp;
}
inline int calc1(int i, int j) {
  int &dp = g[i][j];
  if (~dp) return dp;
  if (!i) return dp = 1;
  dp = 0;
  int swn = sw + j - m, sw0n = sw0 - (m - i - (j - m)) / 2, sw1n = swn - sw0n;
  dp = (dp + 1ll * sw0n * inv[j] % 998244353 * calc1(i - 1, j - 1)) % 998244353;
  dp = (dp + 1ll * (sw1n + 1) * inv[j] % 998244353 * calc1(i - 1, j + 1)) %
       998244353;
  return dp;
}
int main() {
  n = getint(), m = getint();
  for (int i = 1; i <= n; ++i) a[i] = getint();
  sw = sw0 = 0;
  for (int i = 1; i <= n; ++i) {
    w[i] = getint(), sw += w[i];
    if (!a[i]) sw0 += w[i];
  }
  for (int i = 0; i <= (m << 1); ++i)
    inv[i] = qpower(sw + i - m, 998244353 - 2);
  memset(f, -1, sizeof(f));
  memset(g, -1, sizeof(g));
  calc0(m, m), calc1(m, m);
  for (int i = 1; i <= n; ++i)
    if (!a[i])
      printf("%d\n", (int)(1ll * w[i] * f[m][m] % 998244353));
    else
      printf("%d\n", (int)(1ll * w[i] * g[m][m] % 998244353));
  return 0;
}
