#include <bits/stdc++.h>
using namespace std;
long long read() {
  char ch = getchar();
  long long x = 0, ff = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') ff = -ff;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * ff;
}
void write(long long aa) {
  if (aa < 0) putchar('-'), aa = -aa;
  if (aa > 9) write(aa / 10);
  putchar(aa % 10 + '0');
  return;
}
const long long mod = 998244353;
long long n, m, P, Pz, Pf, sumz, sumf;
long long a[200005], b[200005];
long long ban[6005];
long long f[3005][3005], g[3005][3005];
long long ksm(long long aa, long long bb) {
  long long now = 1;
  while (bb) {
    if (bb & 1) now = now * aa % mod;
    aa = aa * aa % mod;
    bb >>= 1;
  }
  return now;
}
int main() {
  n = read(), m = read();
  for (long long i = 1; i <= n; ++i) a[i] = read();
  for (long long i = 1; i <= n; ++i) {
    b[i] = read(), P += b[i];
    if (a[i])
      Pz += b[i];
    else
      Pf += b[i];
  }
  for (long long i = P - m; i <= P + m; ++i) ban[i - P + m] = ksm(i, mod - 2);
  f[0][0] = 1;
  g[0][0] = 1;
  for (long long i = 1; i <= m; ++i)
    for (long long j = 0; j < i; ++j) {
      long long tmp = ban[m - i + j * 2 + 1];
      (f[i][j + 1] += (Pz + j) * tmp % mod * f[i - 1][j] % mod +
                      tmp * f[i - 1][j] % mod) %= mod;
      (f[i][j] +=
       (Pf - i + j + 1 + mod) % mod * tmp % mod * f[i - 1][j] % mod) %= mod;
      tmp = ban[m + i - j * 2 - 1];
      (g[i][j + 1] += (Pf - j + mod) % mod * tmp % mod * g[i - 1][j] % mod -
                      tmp * g[i - 1][j] % mod + mod) %= mod;
      (g[i][j] +=
       (Pz + i - j - 1 + mod) % mod * tmp % mod * g[i - 1][j] % mod) %= mod;
    }
  for (long long i = 0; i <= m; ++i)
    (sumz += f[m][i]) %= mod, (sumf += g[m][i]) %= mod;
  sumz %= mod;
  sumf %= mod;
  for (long long i = 1; i <= n; ++i)
    if (a[i])
      write(b[i] * sumz % mod), puts("");
    else
      write(b[i] * sumf % mod), puts("");
  return 0;
}
