#include <bits/stdc++.h>
using namespace std;
const int maxm = 3010;
const int maxn = 2e5 + 10;
long long mod = 998244353;
long long w[maxn], a[maxn], sa, sb;
int in[maxm][maxm][4], f[maxm][maxm], g[maxm][maxm];
int n, m;
long long step(long long x, long long pw) {
  long long ret = 1;
  while (pw) {
    if (pw & 1) ret = (ret * x) % mod;
    pw /= 2;
    x = (x * x) % mod;
  }
  return ret;
}
long long inv(long long x) { return step(x, mod - 2); }
void go_f(int i, int j) {
  for (int i = m; i >= 0; i--) {
    for (int j = m; j >= 0; j--) {
      if (i + j > m) continue;
      if (i + j == m) {
        f[i][j] = 1;
        continue;
      }
      f[i][j] = ((long long)f[i][j] +
                 (long long)in[i][j][1] * (long long)f[i][j + 1] +
                 (long long)in[i][j][0] * (long long)f[i + 1][j]) %
                mod;
    }
  }
}
void go_g(int i, int j) {
  for (int i = m; i >= 0; i--) {
    for (int j = m; j >= 0; j--) {
      if (i + j > m) continue;
      if (i + j == m) {
        g[i][j] = 1;
        continue;
      }
      g[i][j] = ((long long)g[i][j] +
                 (long long)in[i][j][3] * (long long)g[i + 1][j] +
                 (long long)in[i][j][2] * (long long)g[i][j + 1]) %
                mod;
    }
  }
}
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("%lld", &w[i]);
    if (a[i])
      sa += w[i];
    else
      sb += w[i];
  }
  for (int i = 0; i <= m; i++)
    for (int j = 0; j <= m; j++) {
      if (i + j > m) continue;
      long long pom = inv(sa + sb + i - j);
      in[i][j][0] = ((sa + i + 1) * pom) % mod;
      in[i][j][1] = ((sb - j) * pom) % mod;
      in[i][j][2] = ((sb - j - 1) * pom) % mod;
      in[i][j][3] = ((sa + i) * pom) % mod;
    }
  go_f(0, 0);
  go_g(0, 0);
  for (int i = 1; i <= n; i++) {
    if (a[i])
      printf("%lld ", (w[i] * f[0][0]) % mod);
    else
      printf("%lld ", (w[i] * g[0][0]) % mod);
  }
  return 0;
}
