#include <bits/stdc++.h>
using namespace std;
int put(int a, int p) {
  int ans = 1;
  while (p) {
    if (p & 1) ans = 1LL * ans * a % 998244353;
    a = 1LL * a * a % 998244353;
    p /= 2;
  }
  return ans;
}
int invmod(int x) { return put(x, 998244353 - 2); }
void add(int& a, int b) {
  a += b;
  if (a >= 998244353) a -= 998244353;
}
const int MMAX = 3010;
const int NMAX = 200010;
int w[NMAX], like[NMAX];
int n, m, s, splus, sminus;
int dp[MMAX][MMAX];
int serieplus[NMAX];
int serieminus[NMAX];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", like + i);
  for (int i = 1; i <= n; i++) {
    scanf("%d", w + i);
    s += w[i];
    if (like[i])
      splus += w[i];
    else
      sminus += w[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= i; j++) {
      int nrplus = splus + j;
      int nrminus = sminus - (i - j);
      if (nrminus < 0) assert(dp[i][j] == 0);
      int nrtot = nrplus + nrminus;
      int inv = invmod(nrtot);
      add(dp[i + 1][j], 1LL * dp[i][j] * nrminus % 998244353 * inv % 998244353);
      add(dp[i + 1][j + 1],
          1LL * dp[i][j] * nrplus % 998244353 * inv % 998244353);
    }
  }
  int mult_plus = 0, mult_minus = 0;
  serieplus[0] = 1;
  for (int i = 1; i <= m; i++)
    serieplus[i] =
        1LL * serieplus[i - 1] * (1 + invmod(splus + i - 1)) % 998244353;
  serieminus[0] = 1;
  for (int i = 1; i <= min(m, sminus); i++)
    serieminus[i] = 1LL * serieminus[i - 1] *
                    (1 - invmod(sminus - i + 1) + 998244353) % 998244353;
  for (int i = 0; i <= m; i++) {
    add(mult_plus, 1LL * dp[m][i] * serieplus[i] % 998244353);
    add(mult_minus, 1LL * dp[m][m - i] * serieminus[i] % 998244353);
  }
  for (int i = 1; i <= n; i++) {
    int ans = 1LL * w[i] * (like[i] ? mult_plus : mult_minus) % 998244353;
    if (ans < 0) ans += 998244353;
    printf("%d\n", ans);
  }
  return 0;
}
