#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
const long long Mod = 998244353;
const int N = 200007;
const int M = 3005;
long long A[N], W[N], n, m, a, b, X, Y, dp[M][M];
long long power(long long x, long long y) {
  if (y == 0)
    return 1ll;
  else {
    long long a = (power(x, y / 2));
    long long b = (a * a) % Mod;
    if (y & 1)
      return (b * x) % Mod;
    else
      return b;
  }
}
long long add(long long a, long long b) { return (a + b) % Mod; }
long long mult(long long a, long long b) { return (a * b) % Mod; }
int main() {
  ios_base::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];
    if (A[i])
      X += W[i];
    else
      Y += W[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j <= i; j++) {
      long long a = X + j, b = Y - (i - j);
      long long inv = power(a + b, Mod - 2);
      dp[i + 1][j + 1] = add(dp[i + 1][j + 1], mult(dp[i][j], mult(a, inv)));
      dp[i + 1][j] = add(dp[i + 1][j], mult(dp[i][j], mult(b, inv)));
    }
  }
  long long ea = 0, eb = 0;
  for (int i = 0; i <= m; i++) {
    ea = (ea + mult(dp[m][i], X + i)) % Mod;
    eb = (eb + mult(dp[m][i], Y - (m - i))) % Mod;
  }
  a = power(X, Mod - 2);
  b = power(Y, Mod - 2);
  for (int i = 1; i <= n; i++) {
    if (A[i])
      cout << mult(W[i], mult(ea, a)) << endl;
    else
      cout << mult(W[i], mult(eb, b)) << endl;
  }
  return 0;
}
