#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int first = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) {
    if (ch == '-') f = -1;
  }
  for (; isdigit(ch); ch = getchar()) {
    first = first * 10 + ch - 48;
  }
  return first * f;
}
const int mxN = 2e5;
const int mxM = 3e3;
const int P = 998244353;
int n, m;
long long w[mxN + 3];
int a[mxN + 3];
long long f[mxM + 3][mxM + 3];
void updsum(long long &first, long long second) {
  first += (first + second >= P ? second - P : second);
}
long long quickpow(long long first, long long second) {
  long long cur = first, ret = 1ll;
  for (int i = 0; second; i++) {
    if (second & (1ll << i)) {
      second -= (1ll << i);
      ret = ret * cur % P;
    }
    cur = cur * cur % P;
  }
  return ret;
}
long long mulinv(long long first) { return quickpow(first, P - 2); }
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
  }
  long long sum0 = 0ll, sum1 = 0ll;
  for (int i = 1; i <= n; i++) {
    w[i] = read();
    if (a[i]) {
      sum1 += w[i];
    } else {
      sum0 += w[i];
    }
  }
  f[0][0] = 1ll;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j <= i; j++) {
      updsum(f[i + 1][j + 1],
             f[i][j] * (sum1 + j) % P * mulinv(sum0 + sum1 + 2 * j - i) % P);
      updsum(f[i + 1][j], f[i][j] * (sum0 - i + j) % P *
                              mulinv(sum0 + sum1 + 2 * j - i) % P);
    }
  }
  long long ans1 = 0ll, ans0 = 0ll;
  for (int j = 0; j <= m; j++) {
    ans1 = (ans1 + f[m][j] * j) % P;
  }
  ans0 = (m - ans1 + P) % P;
  for (int i = 1; i <= n; i++) {
    if (a[i]) {
      printf("%lld\n", (w[i] + ans1 * w[i] % P * mulinv(sum1)) % P);
    } else {
      printf("%lld\n", (w[i] - ans0 * w[i] % P * mulinv(sum0) % P + P) % P);
    }
  }
  return 0;
}
