#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int M = 3200;
const int mod = 998244353;
template <typename T>
inline void init(T& x) {
  x = 0;
  char ch = getchar();
  bool t = 0;
  for (; ch > '9' || ch < '0'; ch = getchar())
    if (ch == '-') t = 1;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 1) + (x << 3) + (ch - 48);
  if (t) x = -x;
  return;
}
template <typename T>
inline void Inc(T& x, int y) {
  x += y;
  if (x >= mod) x -= mod;
  return;
}
template <typename T>
inline void Dec(T& x, int y) {
  x -= y;
  if (x < 0) x += mod;
  return;
}
template <typename T>
inline int fpow(int x, T k) {
  int ret = 1;
  for (; k; k >>= 1, x = (long long)x * x % mod)
    if (k & 1) ret = (long long)ret * x % mod;
  return ret;
}
inline int Sum(int x, int y) {
  x += y;
  if (x >= mod) return x - mod;
  return x;
}
inline int Dif(int x, int y) {
  x -= y;
  if (x < 0) return x + mod;
  return x;
}
int f[M][M];
int w[N];
int n, m;
int a[N];
int SA = 0, SB = 0;
int Inv[M << 1];
int MID;
int main() {
  init(n), init(m);
  MID = m;
  for (int i = 1; i <= n; ++i) init(a[i]);
  for (int i = 1; i <= n; ++i) {
    init(w[i]);
    if (a[i])
      SA += w[i];
    else
      SB += w[i];
  }
  f[0][0] = 1;
  for (int i = 0; i <= (m << 1); ++i)
    Inv[i] = fpow((SA + SB + (i - m) + mod) % mod, mod - 2);
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j + i < m; ++j) {
      Inc(f[i + 1][j],
          (long long)f[i][j] * (SA + i) % mod * Inv[m + i - j] % mod);
      if (j < SB)
        Inc(f[i][j + 1],
            (long long)f[i][j] * (SB - j) % mod * Inv[m + i - j] % mod);
    }
  }
  int ans1 = 0, ans2 = 0;
  int InvSA = fpow(SA, mod - 2);
  int InvSB = fpow(SB, mod - 2);
  for (int i = 0; i <= m; ++i) {
    int j = m - i;
    if (!f[i][j]) continue;
    Inc(ans1, (long long)(SA + i) * f[i][j] % mod);
    Inc(ans2, (long long)(SB - j) * f[i][j] % mod);
  }
  for (int i = 1; i <= n; ++i) {
    int ans;
    if (a[i] == 1)
      ans = (long long)ans1 * w[i] % mod * InvSA % mod;
    else
      ans = (long long)ans2 * w[i] % mod * InvSB % mod;
    printf("%d\n", ans);
  }
  return 0;
}
