#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int maxn = 2e5 + 5, maxm = 3e3 + 5;
long long qpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
int a[maxn];
long long w[maxn], dp[maxm][maxm];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  long long l = 0, n_l = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &w[i]);
    a[i] && (l += w[i]);
    a[i] || (n_l += w[i]);
  }
  dp[0][0] = 1;
  for (long long i = 0; i <= m; i++) {
    for (long long j = 0; j <= i; j++) {
      dp[i + 1][j] = (dp[i + 1][j] + dp[i][j] * (n_l - (i - j)) % mod *
                                         qpow(l + n_l + j - (i - j), mod - 2)) %
                     mod;
      dp[i + 1][j + 1] =
          (dp[i + 1][j + 1] +
           dp[i][j] * (l + j) % mod * qpow(l + n_l + j - (i - j), mod - 2)) %
          mod;
    }
  }
  long long f_l = l, f_n_l = n_l;
  for (long long i = 0; i <= m; i++) {
    int no = m - i;
    f_l = (f_l + dp[m][i] * i) % mod;
  }
  f_n_l = (f_n_l - (m - (f_l - l)) + mod) % mod;
  for (int i = 1; i <= n; i++) {
    if (a[i])
      printf("%lld\n", f_l * qpow(l, mod - 2) % mod * w[i] % mod);
    else
      printf("%lld\n", f_n_l * qpow(n_l, mod - 2) % mod * w[i] % mod);
  }
  return 0;
}
