#include <bits/stdc++.h>
using namespace std;
void READ(vector<long long> &v, long long n) {
  long long a;
  for (long long i = 0; i < n; i = i + 1) {
    cin >> a;
    v.push_back(a);
  }
}
void PRINT(vector<long long> &v) {
  long long a;
  for (long long i = 0; i < v.size(); i = i + 1) {
    cout << v[i] << " ";
  }
  cout << "\n";
}
long long power(long long k, long long n, long long m = 998244353) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) {
      res = (res * k) % m;
    }
    k = (k * k) % m;
    n >>= 1;
  }
  return (res);
}
long long n, m, k;
long long good, bad;
long long dp[3003][3003];
long long solve(long long i, long long j) {
  if (i == 0 && j == 0) {
    return (1);
  }
  if (i < 0 || j < 0 || j > bad) {
    return (0);
  }
  if (dp[i][j] != -1) {
    return (dp[i][j]);
  }
  dp[i][j] = ((solve(i - 1, j) % 998244353 * (good + i - 1) % 998244353 *
               power(good + bad + i - 1 - j, 998244353 - 2) % 998244353) %
                  998244353 +
              (solve(i, j - 1) % 998244353 * (bad - j + 1) % 998244353 *
               power(good + bad + i - j + 1, 998244353 - 2) % 998244353)) %
             998244353;
  return (dp[i][j]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  std::cout.unsetf(std::ios::floatfield);
  std::cout.precision(6);
  long long a, b, c, d, e, x, i, j, t, y, w;
  double p, q, r, u;
  char ch, chr;
  cin >> n >> m;
  long long v[n];
  memset(dp, -1, sizeof(dp));
  for (i = 0; i < n; i = i + 1) {
    cin >> a;
    v[i] = a;
  }
  good = bad = 0;
  long long v1[n];
  x = 0;
  y = 0;
  for (i = 0; i < n; i = i + 1) {
    cin >> a;
    if (v[i]) {
      good += a;
    } else {
      bad += a;
    }
    v1[i] = a;
  }
  x = y = 0;
  for (i = 0; i <= m; i = i + 1) {
    x = (x % 998244353 +
         (solve(i, m - i) % 998244353 * i % 998244353) % 998244353) %
        998244353;
    y = (y % 998244353 + 998244353 -
         (solve(i, m - i) % 998244353 * (m - i) % 998244353) % 998244353) %
        998244353;
  }
  a = power(good, 998244353 - 2);
  b = power(bad, 998244353 - 2);
  for (i = 0; i < n; i = i + 1) {
    if (v[i]) {
      cout << (v1[i] + x % 998244353 * v1[i] % 998244353 * a % 998244353) %
                  998244353
           << "\n";
    } else {
      cout << (v1[i] + (y % 998244353 * v1[i] % 998244353 * b % 998244353) %
                           998244353) %
                  998244353
           << "\n";
    }
  }
}
