#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, mod = 998244353;
int a[N], w[N];
int f[3005][3005], g[3005][3005];
int ksm(int b, int n) {
  int res = 1;
  while (n) {
    if (n & 1) res = 1ll * res * b % mod;
    b = 1ll * b * b % mod;
    n >>= 1;
  }
  return res;
}
signed main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) cin >> w[i];
  long long SA = 0, SB = 0;
  for (int i = 1; i <= n; ++i)
    if (a[i])
      SA += w[i];
    else
      SB += w[i];
  SA %= mod, SB %= mod;
  for (int i = 0; i <= m; ++i) f[i][m - i] = g[i][m - i] = 1;
  for (int i = m; i >= 0; --i)
    for (int j = m - 1 - i; j >= 0; --j) {
      if (j > SB) continue;
      int inv = ksm((0ll + SA + SB + i - j + mod) % mod, mod - 2);
      f[i][j] = (1ll * (SA + i + 1) % mod * f[i + 1][j] % mod +
                 1ll * (SB - j + mod) % mod * f[i][j + 1] % mod) %
                mod * inv % mod;
      g[i][j] = (1ll * (SA + i) % mod * g[i + 1][j] % mod +
                 1ll * (SB - j - 1 + mod) % mod * g[i][j + 1] % mod) %
                mod * inv % mod;
    }
  for (int i = 1; i <= n; ++i) {
    if (a[i])
      cout << 1ll * w[i] * f[0][0] % mod << "\n";
    else
      cout << 1ll * w[i] * g[0][0] % mod << "\n";
  }
}
