#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int mxn = 200000, mxm = 3001;
int n, m, x, y;
int a[mxn], b[mxn];
long long first[mxm][mxm], g[mxm][mxm];
int inv(int a) {
  int b = mod, x = 0, y = 1, u = 1, v = 0;
  while (a) {
    int q = b / a, r = b % a;
    tie(x, y, u, v) = make_tuple(u, v, x - u * q, y - v * q);
    b = a, a = r;
  }
  return x + mod * (x < 0);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    (a[i] ? x : y) += b[i];
  }
  for (int i = m; ~i; i--) {
    first[i][m - i] = g[i][m - i] = 1;
    for (int j = m - i - 1; ~j; j--) {
      long long iv = inv(x + y + i - j);
      first[i][j] = ((x + i + 1) * first[i + 1][j] % mod +
                     (y - j) * first[i][j + 1] % mod) *
                    iv % mod;
      g[i][j] =
          ((x + i) * g[i + 1][j] % mod + (y - j - 1) * g[i][j + 1] % mod) * iv %
          mod;
    }
  }
  for (int i = 0; i < n; i++)
    cout << (b[i] * (a[i] ? first[0][0] : g[0][0]) % mod) << '\n';
  return 0;
}
