#include <bits/stdc++.h>
using namespace std;
int mod = 998244353;
int qp(int x, int p) {
  long long ans = 1;
  for (; p; p >>= 1, x = (long long)x * x % mod)
    if (p & 1) ans = ans * x % mod;
  return ans;
}
long long f[3005][3005], g[3005][3005];
int n, m, a[200010];
long long gv, bv, w[200010];
int main() {
  int i, v, j, k;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &w[i]);
    if (a[i])
      gv += w[i];
    else
      bv += w[i];
  }
  for (i = m; i >= 0; --i) {
    f[i][m - i] = g[i][m - i] = 1;
    for (j = min(m - i - 1LL, bv); j >= 0; --j) {
      int qpow = qp(bv + gv + i - j, mod - 2);
      f[i][j] = ((bv - j) * f[i][j + 1] + (gv + i + 1) * f[i + 1][j]) % mod *
                qpow % mod;
      g[i][j] = ((bv - j - 1) * g[i][j + 1] + (gv + i) * g[i + 1][j]) % mod *
                qpow % mod;
    }
  }
  for (i = 1; i <= n; i++) {
    if (a[i])
      printf("%d\n", w[i] * f[0][0] % mod);
    else
      printf("%d\n", w[i] * g[0][0] % mod);
  }
  return 0;
}
