#include <bits/stdc++.h>
using namespace std;
long long MOD = 998244353;
int n, m;
int a[200009];
long long w[200009];
long long sump = 0;
long long sumn = 0;
long long dp1[3009][3009];
long long dp2[3009][3009];
long long getinv(long long x) {
  x %= MOD;
  long long kit = MOD - 2;
  long long res = 1;
  while (kit > 0) {
    if (kit % 2) res = (res * x) % MOD;
    kit /= 2;
    x = (x * x) % MOD;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
    if (a[i] == 0)
      sumn += w[i];
    else
      sump += w[i];
  }
  for (int h = m; h >= 0; h--) {
    for (int i = 0; i <= h; i++) {
      int j = h - i;
      if (h == m) {
        dp1[i][j] = 1;
        dp2[i][j] = 1;
        continue;
      }
      dp1[i][j] = (dp1[i + 1][j] * (sump + i + 1)) % MOD;
      dp1[i][j] = (dp1[i][j] * getinv(sump + sumn + i - j + MOD)) % MOD;
      long long ppls = (dp1[i][j + 1] * (sumn - j + MOD)) % MOD;
      ppls = (ppls * getinv(sump + sumn + i - j + MOD)) % MOD;
      dp1[i][j] = (dp1[i][j] + ppls) % MOD;
      dp2[i][j] = (dp2[i + 1][j] * (sump + i)) % MOD;
      dp2[i][j] = (dp2[i][j] * getinv(sump + sumn + i - j + MOD)) % MOD;
      long long npls = (dp2[i][j + 1] * (sumn - j - 1 + MOD)) % MOD;
      npls = (npls * getinv(sump + sumn + i - j + MOD)) % MOD;
      dp2[i][j] = (dp2[i][j] + npls) % MOD;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0)
      cout << (w[i] * dp2[0][0]) % MOD << '\n';
    else
      cout << (w[i] * dp1[0][0]) % MOD << '\n';
  }
  return 0;
}
