#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, const U &b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, const U &b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T1, class T2>
inline void gn(T1 &x1, T2 &x2) {
  gn(x1), gn(x2);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
long long dp[3100][3100];
int a[200010];
int w[200010];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) gn(w[i]);
  for (int i = 1; i <= n; i++) gn(a[i]);
  long long tot_dis = 0, tot = 0, tot_like = 0;
  for (int i = 1; i <= n; i++) {
    if (w[i])
      tot_like += a[i];
    else
      tot_dis += a[i];
    tot += a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= m; i++) {
    dp[i][0] = dp[i - 1][0] * (tot_like + i - 1) % 998244353 *
               power(tot + i - 1, 998244353 - 2, 998244353) % 998244353;
    for (int j = 1; j <= i; j++)
      if (tot_dis >= j) {
        long long first = 0, second = 0;
        first = dp[i - 1][j - 1] *
                power(tot + i + 1 - 2 * j, 998244353 - 2, 998244353) %
                998244353 * (tot_dis - j + 1) % 998244353;
        if (i != j)
          second = dp[i - 1][j] *
                   power(tot + i - 1 - 2 * j, 998244353 - 2, 998244353) %
                   998244353 * (tot_like + i - 1 - j) % 998244353;
        dp[i][j] = (first + second) % 998244353;
      }
  }
  long long sum = 0;
  for (int j = 0; j <= m; j++)
    sum += j * dp[m][j] % 998244353 * power(tot_dis, 998244353 - 2, 998244353) %
           998244353;
  sum %= 998244353;
  long long s = 0;
  for (int j = 0; j <= m; j++)
    s += j * dp[m][m - j] % 998244353 *
         power(tot_like, 998244353 - 2, 998244353) % 998244353;
  for (int i = 1; i <= n; i++) {
    if (w[i]) {
      long long first = s * a[i] % 998244353;
      first = (first + a[i]) % 998244353;
      printf("%I64d\n", first);
      continue;
    }
    long long first = sum * a[i] % 998244353;
    first = a[i] - first;
    first = (first % 998244353 + 998244353) % 998244353;
    printf("%I64d\n", first);
  }
  return 0;
}
