#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
void ckmin(T &a, U b) {
  if (a > b) a = b;
}
template <class T, class U>
void ckmax(T &a, U b) {
  if (a < b) a = b;
}
int N, M;
bitset<200013> want;
long long arr[200013];
long long prob[3013][3013];
long long choose[3013][3013];
long long tot, bad, good, ibad, igood;
long long expo(long long a, long long e) {
  if (e == 0) return 1;
  if (e & 1) {
    return expo(a * a % 998244353, e >> 1) * a % 998244353;
  }
  return expo(a * a % 998244353, e >> 1);
}
long long modinv(long long x) { return expo(x, 998244353 - 2); }
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> M;
  for (auto i = (0); i < (N); i++) {
    bool b;
    cin >> b;
    want[i] = b;
  }
  for (auto i = (0); i < (N); i++) {
    cin >> arr[i];
    tot += arr[i];
    if (!want[i])
      bad += arr[i];
    else
      good += arr[i];
  }
  ibad = modinv(bad);
  igood = modinv(good);
  prob[0][0] = 1;
  for (auto i = (0); i < (M); i++) {
    for (auto j = (0); j < (i + 1); j++) {
      if (prob[i][j] == 0) continue;
      long long p = (bad - j) * modinv(tot - j + (i - j)) % 998244353;
      prob[i + 1][j + 1] += prob[i][j] * p;
      prob[i + 1][j + 1] %= 998244353;
      prob[i + 1][j] += prob[i][j] * (1 + 998244353 - p);
      prob[i + 1][j] %= 998244353;
    }
  }
  for (auto i = (0); i < (M + 1); i++) {
    choose[i][i] = choose[i][0] = 1;
    for (auto j = (1); j < (i); j++) {
      choose[i][j] = choose[i - 1][j] + choose[i - 1][j - 1];
      if (choose[i][j] >= 998244353) choose[i][j] -= 998244353;
    }
  }
  long long ps = 0, ns = 0;
  for (auto j = (1); j < (M + 1); j++) {
    ps += prob[M][M - j] * j % 998244353 * igood;
    ps %= 998244353;
  }
  for (auto j = (1); j < (M + 1); j++) {
    ns += prob[M][j] * j % 998244353 * ibad;
    ns %= 998244353;
  }
  for (auto i = (0); i < (N); i++) {
    long long ans;
    if (want[i]) {
      ans = (ps + 1) * arr[i] % 998244353;
    } else {
      ans = (998244353 - ns + 1) * arr[i] % 998244353;
    }
    cout << ans << '\n';
  }
}
