#include <bits/stdc++.h>
using namespace std;
const long long infl = 2e18;
const int infi = 1e9;
const int mod = 998244353;
auto clk = clock();
mt19937_64 rang(
    chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
  uniform_int_distribution<int> uid(0, lim - 1);
  return uid(rang);
}
int powm(long long a, long long b) {
  int res = 1;
  a %= mod;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
const int N = 3005;
int a[200005], w[200005];
int dp[N][N];
int invert[2 * N];
void solve() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long sum = 0, good = 0, bad = 0;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
    if (a[i])
      good += w[i];
    else
      bad += w[i];
    sum += w[i];
  }
  for (int i = 3000 - m; i <= 3000 + m; i++) {
    invert[i] = powm(sum + i - 3000, mod - 2);
  }
  dp[0][0] = 1;
  for (int i = 0; i <= m; i++) {
    for (int j = 0; i + j < m; j++) {
      dp[i + 1][j] = (dp[i + 1][j] +
                      ((dp[i][j] * (good + i)) % mod) * invert[3000 + i - j]) %
                     mod;
      dp[i][j + 1] = (dp[i][j + 1] +
                      ((dp[i][j] * (bad - j)) % mod) * invert[3000 + i - j]) %
                     mod;
    }
  }
  long long ansg = 0, ansb = 0;
  for (int i = 0; i <= m; i++) {
    ansg = (ansg + (good + i) * dp[i][m - i]) % mod;
    ansb = (ansb + (bad - m + i) * dp[i][m - i]) % mod;
  }
  ansg = ((ansg * powm(good, mod - 2)) % mod + mod) % mod;
  ansb = ((ansb * powm(bad, mod - 2)) % mod + mod) % mod;
  for (int i = 1; i <= n; i++) {
    if (a[i])
      w[i] = (w[i] * ansg) % mod;
    else
      w[i] = (w[i] * ansb) % mod;
    cout << w[i] << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
  cout << fixed << setprecision(10);
  int t = 1;
  while (t--) solve();
  return 0;
}
