#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, M = 3010, mod = 998244353;
long long a[N], w[N];
long long dp[M][M];
long long inverse(long long x);
long long pwr(long long x, long long e);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  long long bad_wt = 0, good_wt = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> w[i];
    if (a[i]) {
      good_wt += w[i];
    } else {
      bad_wt += w[i];
    }
  }
  for (int j = 0; j <= m and j <= bad_wt; ++j) {
    dp[m][j] = j;
  }
  long long tot_wt = good_wt + bad_wt;
  for (int i = m - 1; i >= 0; --i) {
    for (int j = 0; j <= m and j <= bad_wt; ++j) {
      long long p_bad = (bad_wt - j) * inverse(tot_wt - j + (i - j));
      p_bad %= mod;
      long long p_good = (mod + 1 - p_bad) % mod;
      dp[i][j] = p_bad * dp[i + 1][j + 1] + p_good * dp[i + 1][j];
      dp[i][j] %= mod;
    }
  }
  long long bad_visits = dp[0][0], good_visits = (m - bad_visits + mod) % mod;
  for (int i = 1; i <= n; ++i) {
    long long ans = w[i];
    if (a[i]) {
      ans *= good_visits;
      ans %= mod;
      ans *= inverse(good_wt);
      ans %= mod;
      ans += w[i];
      ans %= mod;
    } else {
      ans *= bad_visits;
      ans %= mod;
      ans *= inverse(bad_wt);
      ans %= mod;
      ans = (w[i] - ans + mod) % mod;
    }
    cout << ans << '\n';
  }
}
long long inverse(long long x) { return pwr(x, mod - 2); }
long long pwr(long long x, long long e) {
  long long res = 1;
  while (e) {
    if (e & 1) {
      res = (res * x) % mod;
    }
    x = (x * x) % mod;
    e /= 2;
  }
  return res;
}
