#include <bits/stdc++.h>
using namespace std;
long long mod_pow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % 998244353;
    a = a * a % 998244353;
    n >>= 1;
  }
  return res;
}
long long n, m;
long long a[200010], w[200010];
long long dp[3011][3011];
int main() {
  scanf("%lld%lld", &n, &m);
  for (long long i = (long long)(0); i < (long long)(n); i++)
    scanf("%lld", a + i);
  for (long long i = (long long)(0); i < (long long)(n); i++)
    scanf("%lld", w + i);
  long long w1 = 0, w2 = 0;
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    if (a[i] == 0)
      w1 += w[i];
    else
      w2 += w[i];
  }
  dp[0][0] = 1;
  for (long long i = (long long)(0); i < (long long)(m); i++) {
    for (long long d1 = (long long)(0); d1 < (long long)(i + 1); d1++) {
      if (w1 - d1 < 0) continue;
      long long d2 = i - d1;
      long long s = w1 - d1 + w2 + d2;
      long long p1 = (w1 - d1) * mod_pow(s, 998244353 - 2) % 998244353;
      if (w1 - d1 > 0)
        (dp[d1 + 1][d2] += dp[d1][d2] * p1 % 998244353) %= 998244353;
      long long p2 = (w2 + d2) * mod_pow(s, 998244353 - 2) % 998244353;
      (dp[d1][d2 + 1] += dp[d1][d2] * p2 % 998244353) %= 998244353;
    }
  }
  {
    long long sum1 = 0, sum2 = 0;
    for (long long d1 = (long long)(0); d1 < (long long)(m + 1); d1++) {
      if (w1 - d1 < 0) continue;
      long long d2 = m - d1;
      sum1 += dp[d1][d2] * (w1 - d1) % 998244353;
      sum1 %= 998244353;
      sum2 += dp[d1][d2] * (w2 + d2) % 998244353;
      sum2 %= 998244353;
    }
    for (long long i = (long long)(0); i < (long long)(n); i++) {
      if (a[i] == 0) {
        cout << ((sum1 * mod_pow(w1, 998244353 - 2)) % 998244353) * w[i] %
                    998244353
             << '\n';
      } else {
        cout << ((sum2 * mod_pow(w2, 998244353 - 2)) % 998244353) * w[i] %
                    998244353
             << '\n';
      }
    }
  }
  return 0;
}
