#include <bits/stdc++.h>
template <class T>
inline void read(T &res) {
  char ch;
  while (ch = getchar(), !isdigit(ch))
    ;
  res = ch ^ 48;
  while (ch = getchar(), isdigit(ch)) res = res * 10 + ch - 48;
}
template <class T>
inline void put(T x) {
  if (x > 9) put(x / 10);
  putchar(x % 10 + 48);
}
const int mod = 998244353;
const int N = 2e5 + 5;
const int M = 3005;
int invs[M << 1], f[M][M], w[N], c[N];
int tot, tot0, tot1, inv_tot0, inv_tot1, n, m;
template <class T>
inline T Min(T x, T y) {
  return x < y ? x : y;
}
inline int quick_pow(int x, int k) {
  int res = 1;
  while (k) {
    if (k & 1) res = 1ll * res * x % mod;
    x = 1ll * x * x % mod;
    k >>= 1;
  }
  return res;
}
inline int ask(int v) {
  if (invs[m + v])
    return invs[m + v];
  else
    return invs[m + v] = quick_pow(tot + v, mod - 2);
}
inline void add(int &x, int y) {
  x += y;
  x >= mod ? x -= mod : 0;
}
inline void dec(int &x, int y) {
  x -= y;
  x < 0 ? x += mod : 0;
}
int main() {
  read(n);
  read(m);
  for (int i = 1; i <= n; ++i) read(c[i]);
  for (int i = 1; i <= n; ++i) {
    read(w[i]);
    if (c[i] == 0)
      tot0 += w[i];
    else
      tot1 += w[i];
    tot += w[i];
  }
  inv_tot0 = quick_pow(tot0, mod - 2);
  inv_tot1 = quick_pow(tot1, mod - 2);
  f[0][0] = 1;
  for (int i = 0; i <= m; ++i)
    for (int j = 0; i + j <= m; ++j)
      if (f[i][j]) {
        f[i + 1][j] =
            (1ll * f[i][j] * (tot1 + i) % mod * ask(i - j) + f[i + 1][j]) % mod;
        f[i][j + 1] =
            (1ll * f[i][j] * (tot0 - j) % mod * ask(i - j) + f[i][j + 1]) % mod;
      }
  int res0 = 0, res1 = 0;
  for (int i = 0; i <= m; ++i) {
    res1 = (1ll * (tot1 + i) * inv_tot1 % mod * f[i][m - i] + res1) % mod;
    if (i < tot0)
      res0 = (1ll * (tot0 - i) * inv_tot0 % mod * f[m - i][i] + res0) % mod;
  }
  for (int i = 1; i <= n; ++i)
    if (c[i] == 0)
      put(1ll * res0 * w[i] % mod), putchar('\n');
    else
      put(1ll * res1 * w[i] % mod), putchar('\n');
  return 0;
}
