#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3005;
const int MAXM = 2e5 + 5;
const int MOD = 998244353;
int dat[MAXM], w[MAXM];
long long f[MAXN][MAXN], g[MAXN][MAXN];
inline int read() {
  int x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
template <typename T1, typename T2>
inline long long add(T1 x, T2 y) {
  return x + y >= MOD ? x + y - MOD : x + y;
}
template <typename T1, typename T2>
inline void Max(T1 &x, T2 y) {
  if (x < y) x = y;
}
template <typename T1, typename T2>
inline void Min(T1 &x, T2 y) {
  if (x > y) x = y;
}
inline int qpow(int x, int y = MOD - 2) {
  long long r = 1, k = x;
  for (; y; y >>= 1) {
    if (y & 1) r *= k, r %= MOD;
    k *= k, k %= MOD;
  }
  return r;
}
int main() {
  int S = 0, SA = 0, SB = 0;
  int n = read(), m = read();
  for (int i = 1; i <= n; i++) dat[i] = read();
  for (int i = 1; i <= n; i++) {
    S += (w[i] = read());
    if (dat[i])
      SA += w[i];
    else
      SB += w[i];
  }
  for (int i = m; ~i; i--) {
    f[i][m - i] = g[i][m - i] = 1;
    for (int j = min(SB, m - i - 1); ~j; j--) {
      long long inv = qpow(S + i - j);
      f[i][j] = add((SA + i + 1) * inv % MOD * f[i + 1][j] % MOD,
                    (SB - j) * inv % MOD * f[i][j + 1] % MOD);
      g[i][j] = add((SA + i) * inv % MOD * g[i + 1][j] % MOD,
                    (SB - j - 1) * inv % MOD * g[i][j + 1] % MOD);
    }
  }
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  for (int i = 1; i <= n; i++)
    cout << w[i] * (dat[i] ? f[0][0] : g[0][0]) % MOD << '\n';
  return 0;
}
