#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 11, MAXM = 3023;
const long long mod = 998244353;
int n, m, like[MAXN];
long long p[MAXN], pl, pd, sum, dp[MAXM][MAXM], iv[MAXM * 2];
long long ksm(long long a, long long x, long long m) {
  long long ret = 1, tmp = (a % m + m) % m;
  while (x) {
    if (x & 1) ret = ret * tmp % m;
    tmp = tmp * tmp % m;
    x >>= 1;
  }
  return ret;
}
long long inv(long long a, long long p) { return ksm(a, p - 2, p); }
long long pw(int w, int b) { return (pl + w) % mod * iv[w - b + m] % mod; }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &like[i]);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &p[i]);
    if (like[i] == 0)
      pd += p[i];
    else
      pl += p[i];
    sum += p[i];
  }
  for (int i = -m; i <= m; ++i) {
    iv[i + m] = inv(pl + pd + i, mod);
  }
  dp[0][0] = 1;
  for (int i = 1; i <= m; ++i) {
    for (int j = 0; j <= i; ++j) {
      dp[i][j] =
          (dp[i - 1][j - 1] * pw(j - 1, i - j) % mod +
           dp[i - 1][j] * (((1 - pw(j, i - j - 1)) % mod + mod) % mod) % mod) %
          mod;
    }
  }
  long long ew = 0, eb;
  for (int i = 1; i <= m; ++i) {
    ew = (ew + i * dp[m][i] % mod) % mod;
  }
  eb = m - ew;
  for (int i = 1; i <= n; ++i) {
    if (like[i] == 1) {
      p[i] = (p[i] + ew * p[i] % mod * inv(pl, mod) % mod) % mod;
    } else {
      p[i] = ((p[i] - eb * p[i] % mod * inv(pd, mod) % mod) % mod + mod) % mod;
    }
    printf("%lld\n", p[i]);
  }
  return 0;
}
