#include <bits/stdc++.h>
using namespace std;
const int maxn = 222222, maxm = 3333, MOD = 998244353;
int muln(int x, int y) { return 1LL * x * y % MOD; }
int qpow(int x, int y) {
  int ret = 1;
  for (; y; y >>= 1, x = muln(x, x))
    if (y & 1) ret = muln(ret, x);
  return ret;
}
int inverse(int x) { return qpow(x, MOD - 2); }
int a[maxn], w[maxn], n, m, like, diss, tot, dp[maxm][maxm], _inv[maxm * 5];
int ans[maxn];
inline int inv(int x) { return _inv[x - tot + m]; }
inline void upd(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
int mo(int x) {
  if (x >= MOD) return x - MOD;
  if (x < 0) return x + MOD;
  return x;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (int i = 1; i <= n; ++i) a[i] ? (like += w[i]) : (diss += w[i]);
  tot = like + diss;
  for (int i = max(0, tot - m); i <= tot + m; ++i)
    _inv[i - tot + m] = inverse(i);
  dp[0][0] = 1;
  for (int i = 0; i < m; ++i) {
    for (int add = 0; add <= i; ++add) {
      int sub = i - add, nlike = like + add, ndiss = diss - sub;
      int ntot = nlike + ndiss, ntot_inv = inv(ntot);
      upd(dp[i + 1][add], muln(dp[i][add], muln(ndiss, ntot_inv)));
      upd(dp[i + 1][add + 1], muln(dp[i][add], muln(nlike, ntot_inv)));
    }
  }
  int exp_add = 0, exp_sub = 0;
  for (int add = 0; add <= m; ++add) {
    upd(exp_add, muln(dp[m][add], add));
    upd(exp_sub, muln(dp[m][add], m - add));
  }
  exp_add = muln(exp_add, inverse(like));
  exp_sub = muln(exp_sub, inverse(diss));
  for (int i = 1; i <= n; ++i) {
    if (a[i])
      printf("%d\n", mo(w[i] + muln(w[i], exp_add)));
    else
      printf("%d\n", mo(w[i] - muln(w[i], exp_sub)));
  }
  return 0;
}
