#include <bits/stdc++.h>
const long long p = 998244353;
template <class t>
inline void read(t &s) {
  s = 0;
  register long long f = 1;
  register char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) s = (s << 3) + (s << 1) + (c ^ 48), c = getchar();
  s *= f;
  return;
}
template <class t, class... A>
inline void read(t &x, A &...a) {
  read(x);
  read(a...);
}
template <class t>
inline void write(t x) {
  if (x < 0) putchar('-'), x = -x;
  long long buf[21], top = 0;
  while (x) buf[++top] = x % 10, x /= 10;
  if (!top) buf[++top] = 0;
  while (top) putchar(buf[top--] ^ '0');
  return;
}
inline void setIn(std::string s) {
  freopen(s.c_str(), "r", stdin);
  return;
}
inline void setOut(std::string s) {
  freopen(s.c_str(), "w", stdout);
  return;
}
inline void setIO(std::string s = "") {
  setIn(s + ".in");
  setOut(s + ".out");
  return;
}
template <class t>
inline bool checkmin(t &x, t y) {
  if (x > y) {
    x = y;
    return 1;
  }
  return 0;
}
template <class t>
inline bool checkmax(t &x, t y) {
  if (x < y) {
    x = y;
    return 1;
  }
  return 0;
}
inline long long lowbit(long long x) { return x & (-x); }
const long long MaxN = 3050;
long long a[200050], w[200050], f[MaxN][MaxN], g[MaxN][MaxN];
long long sG, sB, AL, n, m;
inline long long fpow(long long a, long long b) {
  register long long res = 1;
  for (; b; b >>= 1, a = a * a % p)
    if (b & 1) res = res * a % p;
  return res;
}
inline long long inv(long long x) {
  ((x %= p) += p) %= p;
  return fpow(x, p - 2);
}
inline void add(long long &x, long long y) { (x += y) >= p && (x -= p); }
signed main(void) {
  read(n, m);
  for (long long i = 1; i <= n; ++i) read(a[i]);
  for (long long i = 1; i <= n; ++i) read(w[i]);
  for (long long i = 1; i <= n; ++i)
    if (a[i])
      (sG += w[i]) %= p;
    else
      (sB += w[i]) %= p;
  AL = (sG + sB) % p;
  for (long long i = 0; i <= m; ++i) f[i][m - i] = g[i][m - i] = 1;
  for (long long len = m - 1; ~len; --len)
    for (long long i = 0; len - i >= 0; ++i) {
      register long long j = len - i;
      add(f[i][j], (sG + i + 1) * inv(AL + i - j) % p * f[i + 1][j] % p),
          add(f[i][j],
              (sB - j + p) % p * inv(AL + i - j) % p * f[i][j + 1] % p),
          add(g[i][j], (sG + i) * inv(AL + i - j) % p * g[i + 1][j] % p),
          add(g[i][j],
              (sB - j - 1 + p) % p * inv(AL + i - j) % p * g[i][j + 1] % p);
    }
  for (long long T = 1; T <= n; ++T)
    if (a[T])
      write(f[0][0] * w[T] % p), std::puts("");
    else
      write(g[0][0] * w[T] % p), std::puts("");
  return 0;
}
