#include <bits/stdc++.h>
using namespace std;
int N, M;
int A[202020];
signed long long W[202020];
signed long long SW[2];
signed long long mo = 998244353;
signed long long dp[3030][3030];
signed long long modpow(signed long long a, signed long long n = mo - 2) {
  signed long long r = 1;
  a %= mo;
  while (n) r = r * ((n % 2) ? a : 1) % mo, a = a * a % mo, n >>= 1;
  return r;
}
signed long long comb(int P_, int Q_) {
  static const int N_ = 4020;
  static signed long long C_[N_][N_];
  if (C_[0][0] == 0) {
    int i, j;
    for (i = 0; i < (N_); i++) C_[i][0] = C_[i][i] = 1;
    for (i = 1; i < N_; i++)
      for (j = 1; j < i; j++) C_[i][j] = (C_[i - 1][j - 1] + C_[i - 1][j]) % mo;
  }
  if (P_ < 0 || P_ > N_ || Q_ < 0 || Q_ > P_) return 0;
  return C_[P_][Q_];
}
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N >> M;
  for (i = 0; i < (N); i++) cin >> A[i];
  for (i = 0; i < (N); i++) {
    cin >> W[i];
    SW[A[i]] += W[i];
  }
  dp[0][0] = 1;
  for (x = 0; x < (M); x++)
    for (y = 0; y < (M); y++)
      if (x + y < M && dp[x][y]) {
        signed long long a = SW[1] + x;
        signed long long b = SW[0] - y;
        (dp[x + 1][y] += dp[x][y] * a % mo * modpow(a + b)) %= mo;
        (dp[x][y + 1] += dp[x][y] * b % mo * modpow(a + b)) %= mo;
      }
  for (i = 0; i < (N); i++) {
    int p, q;
    signed long long ret = 0;
    signed long long Xs = 1;
    if (A[i] == 1) {
      for (p = 0; p <= M; p++) {
        (Xs *= W[i] + p) %= mo;
        signed long long sum = 0;
        for (q = 0; p + q <= M; q++) {
          signed long long a = 1, b = 1;
          for (j = 0; j < (q); j++) a = a * (SW[1] - W[i] + j) % mo;
          for (j = 0; j < (p + q); j++) b = b * (SW[1] + j) % mo;
          a = a * modpow(b) % mo;
          a = a * comb(p + q, p) % mo;
          (sum += a * dp[p + q][M - (p + q)]) %= mo;
        }
        (ret += Xs * sum) %= mo;
      }
    } else {
      for (p = 0; p <= min(M, (int)SW[0]); p++) {
        (Xs *= W[i] - p) %= mo;
        signed long long sum = 0;
        for (q = 0; p + q <= min(M, (int)SW[0]); q++) {
          signed long long a = 1, b = 1;
          for (j = 0; j < (q); j++) a = a * (SW[0] - W[i] - j) % mo;
          for (j = 0; j < (p + q); j++) b = b * (SW[0] - j) % mo;
          a = a * modpow(b) % mo;
          a = a * comb(p + q, p) % mo;
          (sum += a * dp[M - (p + q)][p + q]) %= mo;
        }
        (ret += Xs * sum) %= mo;
      }
    }
    cout << ret << endl;
  }
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
