#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int M = 3005;
const int mod = 998244353;
inline int quickpow(int x, int k) {
  int res = 1;
  while (k) {
    if (k & 1) res = 1LL * res * x % mod;
    x = 1LL * x * x % mod;
    k >>= 1;
  }
  return res;
}
inline int inv(int x) { return quickpow(x, mod - 2); }
inline int div_mod(int x, int y) { return 1LL * x * inv(y) % mod; }
int n, m;
int submax, a[N], w[N];
int dp[M][M];
inline bool check(int i, int j) {
  int add = j, sub = i - j;
  return (add >= 0 && sub >= 0 && sub <= submax);
}
int ans[N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int sum[2] = {0, 0};
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]), sum[a[i]] += w[i];
    if (a[i] == 0) submax += w[i];
  }
  int inv_2 = inv(2);
  dp[0][0] = 1;
  for (int i = 1; i <= m; i++)
    for (int j = 0; j <= i; j++) {
      if (!check(i, j)) continue;
      if (check(i - 1, j - 1)) {
        int mul = div_mod(sum[1] + j - 1,
                          sum[0] + sum[1] + j - 1 - (i - 1 - (j - 1)));
        dp[i][j] = (dp[i][j] + 1LL * dp[i - 1][j - 1] * mul) % mod;
      }
      if (check(i - 1, j)) {
        int mul =
            div_mod(sum[0] - (i - 1 - j), sum[0] + sum[1] + j - (i - 1 - j));
        dp[i][j] = (dp[i][j] + 1LL * dp[i - 1][j] * mul) % mod;
      }
    }
  for (int i = 0; i <= m; i++)
    if (check(m, i)) {
      int mul[2];
      mul[0] = 1LL * div_mod(sum[0] - (m - i), sum[0]) * dp[m][i] % mod;
      mul[1] = 1LL * div_mod(sum[1] + i, sum[1]) * dp[m][i] % mod;
      for (int j = 1; j <= n; j++)
        ans[j] = (ans[j] + 1LL * mul[a[j]] * w[j]) % mod;
    }
  for (int i = 1; i <= n; i++) printf("%d\n", ans[i]);
  return 0;
}
