#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10, MAXM = 3005;
int n, m;
const long long mod = 998244353;
long long a[MAXN], w[MAXN], neg = 0, pos = 0;
long long dp[2][MAXM];
unordered_map<long long, long long> inv_memo;
long long correct(long long x) {
  if (x < 0) x += ((-x) / mod + 1) * mod;
  x %= mod;
  return x;
}
long long mul(long long x, long long y) {
  x = correct(x);
  y = correct(y);
  return x * y % mod;
}
long long mypow(long long x, long long n) {
  if (!n) return 1;
  long long tmp = mypow(x, n / 2);
  if (n % 2 == 0)
    return tmp * tmp % mod;
  else
    return tmp * tmp % mod * x % mod;
}
long long inv(long long x) {
  if (inv_memo.count(x)) return inv_memo[x];
  return inv_memo[x] = mypow(x, mod - 2);
}
long long divv(long long x, long long y) {
  x = correct(x);
  y = correct(y);
  return mul(x, inv(y));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> w[i];
  for (int i = 0; i < n; i++) {
    if (a[i] == 0)
      neg += w[i];
    else
      pos += w[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j <= i + 1; j++) dp[(i + 1) & 1][j] = 0;
    for (int j = 0; j <= i; j++) {
      dp[(i + 1) & 1][j] +=
          divv(mul(dp[i & 1][j], pos + i - j), pos + neg + i - j - j);
      if (neg - j > 0)
        dp[(i + 1) & 1][j + 1] +=
            divv(mul(dp[i & 1][j], neg - j), pos + neg + i - j - j);
    }
    for (int j = 0; j <= i + 1; j++)
      dp[(i + 1) & 1][j] = correct(dp[(i + 1) & 1][j]);
  }
  long long res1 = 0, res2 = 0;
  for (int i = 0; i <= m; i++) {
    res1 += mul(dp[m & 1][i], pos + m - i);
    res2 += mul(dp[m & 1][i], neg - i);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 0)
      cout << divv(mul(res2, w[i]), neg) << endl;
    else
      cout << divv(mul(res1, w[i]), pos) << endl;
  }
  return 0;
}
