#include <bits/stdc++.h>
using namespace std;
template <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "URDL";
const long long MOD2 = (long long)998244353 * (long long)998244353;
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 998244353) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 998244353) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
int a[200008], w[200008];
int f[3035][3035], g[3035][3035];
int sa, sb;
void fmain(int tid) {
  scanf("%d%d", &n, &m);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", a + i);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", w + i);
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    if (a[i])
      addmod(sa, w[i]);
    else
      addmod(sb, w[i]);
  }
  for (int(i) = 0; (i) < (int)(m + 1); (i)++) {
    f[i][m - i] = 1;
    g[i][m - i] = 1;
  }
  for (int len = m - 1; len >= 0; len--) {
    for (int i = 0; i <= len; i++) {
      int j = len - i;
      int ni = fastPow(sa + sb + i - j, 998244353 - 2);
      f[i][j] =
          (long long)f[i + 1][j] * (sa + i + 1) % 998244353 * ni % 998244353;
      if (j < sb)
        addmod(f[i][j],
               (long long)f[i][j + 1] * (sb - j) % 998244353 * ni % 998244353);
      g[i][j] = (long long)g[i + 1][j] * (sa + i) % 998244353 * ni % 998244353;
      if (j + 1 < sb)
        addmod(g[i][j], (long long)g[i][j + 1] * (sb - j - 1) % 998244353 * ni %
                            998244353);
    }
  }
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    if (a[i]) {
      printf("%lld\n", (long long)f[0][0] * w[i] % 998244353);
    } else {
      printf("%lld\n", (long long)g[0][0] * w[i] % 998244353);
    }
  }
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
