#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int n, m;
int a[200200], w[200200];
long long sa, sb, sum;
long long f[3030][3030], g[3030][3030];
long long qpow(long long x, long long k) {
  long long r = 1;
  while (k) {
    if (k & 1) r = r * x % mod;
    k >>= 1;
    x = x * x % mod;
  }
  return r;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &w[i]);
    sa += a[i] * w[i];
    sum += w[i];
  }
  sb = sum - sa;
  long long zi, mu;
  for (int i = m; i >= 0; --i) {
    f[i][m - i] = g[i][m - i] = 1;
    for (int j = m - i - 1; j >= 0; --j) {
      zi = sa + i;
      mu = qpow(sum + i - j, mod - 2);
      f[i][j] = (zi + 1) * mu % mod * f[i + 1][j] % mod;
      g[i][j] = zi * mu % mod * g[i + 1][j] % mod;
      zi = sb - j;
      (f[i][j] += zi * mu % mod * f[i][j + 1] % mod) %= mod;
      (g[i][j] += (zi - 1) * mu % mod * g[i][j + 1] % mod) %= mod;
    }
  }
  for (int i = 1; i <= n; ++i)
    if (a[i])
      printf("%lld\n", w[i] * f[0][0] % mod);
    else
      printf("%lld\n", w[i] * g[0][0] % mod);
  return 0;
}
