#include <bits/stdc++.h>
using std::cerr;
using std::endl;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int MAXN = 200005;
const int MAXM = 3005;
const int MOD = 998244353;
int n, m, a[MAXN], w[MAXN], tot0, tot1;
int f[MAXM][MAXM];
inline int qpow(int x, int y) {
  int ret = 1, tt = x % MOD;
  while (y) {
    if (y & 1) ret = 1ll * ret * tt % MOD;
    tt = 1ll * tt * tt % MOD;
    y >>= 1;
  }
  return ret;
}
int main() {
  n = read(), m = read();
  for (int i = (1); i <= (n); ++i) a[i] = read();
  for (int i = (1); i <= (n); ++i) {
    w[i] = read();
    if (!a[i])
      tot0 += w[i];
    else
      tot1 += w[i];
  }
  f[0][0] = 1;
  for (int i = (0); i <= (m - 1); ++i) {
    for (int j = (0); j <= (std::min(tot0, i)); ++j) {
      f[i + 1][j + 1] =
          (f[i + 1][j + 1] + 1ll * f[i][j] * (tot0 - j) % MOD *
                                 qpow(tot0 - j + tot1 + i - j, MOD - 2)) %
          MOD;
      f[i + 1][j] = (f[i + 1][j] + 1ll * f[i][j] * (tot1 + i - j) % MOD *
                                       qpow(tot0 - j + tot1 + i - j, MOD - 2)) %
                    MOD;
    }
  }
  int exp0 = 0, exp1 = 0;
  for (int i = (0); i <= (m); ++i) {
    exp0 = (exp0 + 1ll * f[m][i] * i) % MOD;
    exp1 = (exp1 + 1ll * f[m][i] * (m - i)) % MOD;
  }
  for (int i = (1); i <= (n); ++i) {
    if (!a[i])
      printf(
          "%I64d\n",
          (w[i] - 1ll * exp0 * w[i] % MOD * qpow(tot0, MOD - 2) % MOD + MOD) %
              MOD);
    else
      printf("%I64d\n",
             (w[i] + 1ll * exp1 * w[i] % MOD * qpow(tot1, MOD - 2)) % MOD);
  }
  return 0;
}
