#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int MAXN = 200005;
const int MAXM = 3005;
long long modpow(long long x, int p) {
  if (p == 0) return 1;
  if (p % 2 == 1) return (modpow(x, p - 1) * x) % MOD;
  long long r = modpow(x, p / 2);
  return (r * r) % MOD;
}
long long modinv(long long x) { return modpow(x, MOD - 2); }
int n, m, a[MAXN], w[MAXN];
long long dp[MAXM][MAXM];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  long long sx = 0, sy = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &w[i]);
    if (a[i] == 0)
      sy += w[i];
    else
      sx += w[i];
  }
  for (int i = 0; i < m; i++)
    for (int j = 0; j <= i; j++) {
      if (i == 0) {
        dp[i][j] = 1;
      }
      dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * (sx + j) % MOD *
                                                 modinv(sx + sy - i + 2 * j)) %
                         MOD;
      dp[i + 1][j] = (dp[i + 1][j] + dp[i][j] * (sy - i + j) % MOD *
                                         modinv(sx + sy - i + 2 * j)) %
                     MOD;
    }
  long long ax = dp[m][0], ra = 1;
  for (int i = 0; i < m; i++) {
    ra = (ra + ra * modinv(sx + i)) % MOD;
    ax = (ax + ra * dp[m][i + 1]) % MOD;
  }
  long long bx = dp[m][m], rb = 1;
  for (int i = 0; i < m; i++) {
    rb = (rb - rb * modinv(sy - i) + 1LL * MOD * MOD) % MOD;
    bx = (bx + rb * dp[m][m - i - 1]) % MOD;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 1) {
      printf("%I64d\n", ax * w[i] % MOD);
    } else {
      printf("%I64d\n", bx * w[i] % MOD);
    }
  }
  return 0;
}
