#include <bits/stdc++.h>
using namespace std;
const long double inf = 2e18;
const int maxn = 200020;
const long long mod = 998244353;
int n, m, a[maxn], w[maxn];
long long sum0, sum1, f[3020][3020];
void add(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
long long power(long long x, long long y) {
  x = (x + mod) % mod;
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return res;
}
int main() {
  scanf("%d %d", &n, &m);
  for (register int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (register int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
    if (!a[i])
      add(sum0, w[i]);
    else
      add(sum1, w[i]);
  }
  f[0][0] = 1;
  for (register int i = 1; i <= m; i++) {
    long long cinv = power(sum0 + sum1 - i + 1, mod - 2);
    f[i][0] = f[i - 1][0] * (sum0 - i + 1) % mod * cinv % mod;
    for (register int j = 1; j <= i; j++) {
      f[i][j] = (f[i - 1][j - 1] * (sum1 + j - 1) % mod *
                     power(sum0 + sum1 + 2 * (j - 1) - (i - 1), mod - 2) % mod +
                 f[i - 1][j] * (sum0 - i + 1 + j) % mod *
                     power(sum0 + sum1 + 2 * j - (i - 1), mod - 2) % mod) %
                mod;
    }
  }
  long long ans0 = 0, ans1 = 0, totp = 0;
  for (register int i = 0; i <= m; i++) {
    add(ans0, (m - i) * f[m][i] % mod);
    add(ans1, i * f[m][i] % mod);
  }
  long long inv0 = power(sum0, mod - 2), inv1 = power(sum1, mod - 2);
  for (int i = 1; i <= n; i++) {
    if (a[i]) {
      printf("%lld\n",
             ((long long)w[i] + ans1 * w[i] % mod * inv1 % mod) % mod);
    } else {
      printf("%lld\n",
             ((long long)w[i] - ans0 * w[i] % mod * inv0 % mod + mod) % mod);
    }
  }
}
