#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 998244353;
const int N = 2e5, M = 3e3;
int n, m, a[N + 2], w[N + 2], sa, sb;
long long add(long long x, long long y) {
  long long z = x + y;
  while (z >= MOD) z -= MOD;
  return z;
}
long long add(const initializer_list<long long>& l) {
  long long x = 0;
  for (long long y : l) x = add(x, y);
  return x;
}
long long mul(long long x, long long y) {
  long long z = x * y;
  return (z >= MOD) ? z % MOD : z;
}
long long mul(const initializer_list<long long>& l) {
  long long x = 1;
  for (long long y : l) x = mul(x, y);
  return x;
}
long long power(long long x, long long n) {
  if (n == 0) return 1;
  long long y = power(x, n >> 1);
  y = mul(y, y);
  return (n & 1) ? mul(y, x) : y;
}
long long inv(long long x) { return power(x, MOD - 2); }
int _inv2[M + M + 2] = {0};
int inv2(int j, int k) {
  int& ans = _inv2[j - k + M];
  if (ans == 0) {
    int total = add({sa, j, sb, MOD - k});
    ans = inv(total);
  }
  return ans;
}
int memo[2][M + 2][M + 2];
int dp(int type, int j, int k) {
  int i = j + k;
  int total = add({sa, j, sb, MOD - k});
  if (i == m) return 1;
  if (total == 0) return 0;
  int& ans = memo[type][j][k];
  if (ans == -1) {
    int invtotal = inv2(j, k);
    if (type == 1) {
      int tans1 = mul({add({sa, j, 1}), dp(type, j + 1, k)});
      int tans2 = mul({add(sb, MOD - k), dp(type, j, k + 1)});
      ans = mul(add({tans1, tans2}), invtotal);
    } else if (type == 0) {
      int tans1 = mul({add(sa, j), dp(type, j + 1, k)});
      int tans2 = mul({add({sb, MOD - k, MOD - 1}), dp(type, j, k + 1)});
      ans = mul(add({tans1, tans2}), invtotal);
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.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];
  sa = 0, sb = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i])
      sa = add(sa, w[i]);
    else
      sb = add(sb, w[i]);
  }
  memset(memo, -1, sizeof(memo));
  for (int i = 1; i <= n; ++i) {
    cout << mul(w[i], dp(a[i], 0, 0)) << '\n';
  }
}
