#include <bits/stdc++.h>
const int mod = 998244353;
const int MaxN = 2e5 + 10;
const int MaxM = 3e3 + 10;
struct mod_t {
  int x;
  mod_t() {}
  mod_t(long long v) : x(v) {}
  mod_t(int v) : x(v) {}
  static int Mod(int x) { return ((x < 0) ? (x + mod) : x); }
  mod_t operator+(const mod_t y) const { return Mod(x + y.x - mod); }
  mod_t operator-(const mod_t y) const { return Mod(x - y.x); }
  mod_t operator*(const mod_t y) const { return (long long)x * y.x % mod; }
};
int n, m, a[MaxN];
mod_t wa, wb, w[MaxN], f[MaxM][MaxM];
mod_t fast_pow(mod_t a, int b) {
  mod_t ret = 1;
  while (b) {
    if (b & 1) ret = ret * a;
    a = a * a;
    b >>= 1;
  }
  return ret;
}
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].x);
  for (int i = 1; i <= n; i++) {
    if (a[i])
      wa = wa + w[i];
    else
      wb = wb + w[i];
  }
  f[0][0] = 1;
  for (int i = 1; i <= m; i++) {
    f[i][0] = f[i - 1][0] * (wa + i - 1) * (fast_pow(wa + wb + i - 1, mod - 2));
    for (int j = 1; j <= i; j++) {
      f[i][j] = f[i - 1][j] * (wa + i - 1 - j) *
                (fast_pow(wa + wb + i - 1 - 2 * j, mod - 2));
      f[i][j] = f[i][j] + f[i - 1][j - 1] * (wb - j + 1) *
                              (fast_pow(wa + wb + i + 1 - 2 * j, mod - 2));
    }
  }
  mod_t sa = wa, sb = wb;
  for (int i = 0; i <= m; i++) {
    sb = sb - f[m][i] * mod_t(i);
    sa = sa + f[m][i] * mod_t(m - i);
  }
  for (int i = 1; i <= n; i++) {
    if (a[i])
      printf("%d\n", (sa * w[i] * (fast_pow(wa, mod - 2))).x);
    else
      printf("%d\n", (sb * w[i] * (fast_pow(wb, mod - 2))).x);
  }
  return 0;
}
