#include <bits/stdc++.h>
using namespace std;
const int rw = 998244353;
int ksm(int x, int y) {
  int ans = 1;
  while (y) {
    if (y & 1) ans = 1LL * x * ans % rw;
    x = 1LL * x * x % rw;
    y >>= 1;
  }
  return ans;
}
int n, m;
int a[200005], b[200005], w0, w1;
int dp[3005][3005];
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", &b[i]);
    if (a[i])
      w1 += b[i];
    else
      w0 += b[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i < m; i++) {
    for (int j = 0; i + j < m; j++) {
      dp[i + 1][j] = (dp[i + 1][j] + 1LL * dp[i][j] * (w1 + i) % rw *
                                         ksm(w1 + w0 + i - j, rw - 2)) %
                     rw;
      dp[i][j + 1] = (dp[i][j + 1] + 1LL * dp[i][j] * (w0 - j) % rw *
                                         ksm(w1 + w0 + i - j, rw - 2)) %
                     rw;
    }
  }
  int ans1 = 0, ans0 = 0;
  for (int i = 0; i <= m; i++) {
    ans1 = (ans1 + 1LL * i * dp[i][m - i]) % rw;
    ans0 = (ans0 + 1LL * i * dp[m - i][i]) % rw;
  }
  ans1 = 1LL * ksm(w1, rw - 2) * ans1 % rw;
  ans0 = 1LL * ksm(w0, rw - 2) * ans0 % rw;
  for (int i = 1; i <= n; i++) {
    if (a[i])
      printf("%lld\n", ((b[i] + 1LL * ans1 * b[i]) % rw + rw) % rw);
    else
      printf("%lld\n", ((b[i] - 1LL * ans0 * b[i]) % rw + rw) % rw);
  }
}
