#include <bits/stdc++.h>
using namespace std;
const long long M = 3e3 + 2;
const long long N = 2e5 + 2;
const long long mod = 998244353;
long long wow[M << 2];
long long binpow(long long x, long long y) {
  long long tich = 1;
  while (y) {
    if (y & 1) {
      tich *= x;
      tich %= mod;
    }
    x *= x;
    x %= mod;
    y >>= 1;
  }
  return tich;
}
long long add(long long x, long long y) {
  if (x + y >= mod) {
    return x + y - mod;
  }
  return x + y;
}
long long mul(long long x, long long y) { return (x * y) % mod; }
long long dp[M][M], dp1[M][M], w[N], suma = 0, sumb = 0, m;
bool like[N], check[M][M], check1[M][M];
long long compute(long long x, long long y) {
  if (x + y == m) {
    dp[x][y] = 1;
    return 1;
  }
  if (check[x][y]) {
    return dp[x][y];
  }
  check[x][y] = true;
  long long inv = wow[x - y + M];
  dp[x][y] = add(mul(suma + x + 1, mul(inv, compute(x + 1, y))),
                 mul(sumb - y, mul(inv, compute(x, y + 1))));
  return dp[x][y];
}
long long compute1(long long x, long long y) {
  if (x + y == m) {
    dp1[x][y] = 1;
    return 1;
  }
  if (check1[x][y]) {
    return dp1[x][y];
  }
  check1[x][y] = true;
  long long inv = wow[x - y + M];
  dp1[x][y] = add(mul(suma + x, mul(inv, compute1(x + 1, y))),
                  mul(sumb - y - 1, mul(inv, compute1(x, y + 1))));
  return dp1[x][y];
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, i, j, k, l;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> j;
    if (j) {
      like[i] = true;
    }
  }
  for (i = 1; i <= n; i++) {
    cin >> w[i];
    if (like[i]) {
      suma = add(suma, w[i]);
    } else {
      sumb = add(sumb, w[i]);
    }
  }
  for (i = suma + sumb - m; i <= suma + sumb + m; i++) {
    wow[-suma - sumb + i + M] = binpow(i, mod - 2);
  }
  compute(0, 0);
  compute1(0, 0);
  for (i = 1; i <= n; i++) {
    if (like[i]) {
      cout << mul(dp[0][0], w[i]) << '\n';
    } else {
      cout << mul(dp1[0][0], w[i]) << '\n';
    }
  }
}
