#include <bits/stdc++.h>
using namespace std;
const int inf = 2147483647;
template <typename T>
inline T read() {
  T sum = 0, fl = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fl = -1;
  for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
  return sum * fl;
}
const int maxn = 2e5 + 5, maxm = 3e3 + 5;
const int mod = 998244353;
int n, m, Sa, Sb;
int a[maxn], w[maxn], f[maxm][maxm], g[maxm][maxm], fac[maxm << 1];
int pow(int a, int b) {
  int u = 1;
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) u = 1ll * u * a % mod;
  return u;
}
void Solve() {
  n = read<int>(), m = read<int>();
  for (int i = 1; i <= n; ++i) a[i] = read<int>();
  for (int i = 1; i <= n; ++i) w[i] = read<int>();
  for (int i = 1; i <= n; ++i) {
    if (a[i])
      Sa += w[i];
    else
      Sb += w[i];
  }
  for (int i = 0; i <= m; ++i) f[i][m - i] = 1, g[i][m - i] = 1;
  for (int i = -m; i <= m; ++i) fac[i + m] = pow(Sa + Sb + i, mod - 2);
  for (int s = m - 1; s >= 0; --s) {
    for (int i = s; i >= 0; --i) {
      int j = s - i;
      f[i][j] = ((long long)(Sa + i + 1) * f[i + 1][j] % mod +
                 (long long)(Sb - j) * f[i][j + 1] % mod) *
                fac[i - j + m] % mod;
      g[i][j] = ((long long)(Sa + i) * g[i + 1][j] % mod +
                 (long long)(Sb - j - 1) * g[i][j + 1] % mod) *
                fac[i - j + m] % mod;
    }
  }
  for (int i = 1; i <= n; ++i)
    if (a[i])
      printf("%d\n", (long long)w[i] * f[0][0] % mod);
    else
      printf("%d\n", (long long)w[i] * g[0][0] % mod);
}
int main() {
  Solve();
  return 0;
}
