#include <bits/stdc++.h>
using namespace std;
const long long N = 2 * 1e5 + 100, M = 3100;
;
long long n, m, a[N], w[N], dp[M][M][2], s1, s2;
inline void add(long long &a, long long b) { a = (a + b) % 998244353; }
inline void del(long long &a, long long b) {
  a = (a - b + 998244353) % 998244353;
}
inline void mul(long long &a, long long b) { a = (a * b) % 998244353; }
inline long long m_pow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) mul(ans, a);
    b >>= 1;
    mul(a, a);
  }
  return ans;
}
signed main() {
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (long long i = 1; i <= n; i++) scanf("%lld", &w[i]);
  for (long long i = 1; i <= n; i++)
    if (a[i] == 0) a[i] = -1;
  for (long long i = 1; i <= n; i++) ((a[i] == 1) ? s1 += w[i] : s2 += w[i]);
  for (long long i = 0; i <= m; i++) dp[i][m - i][0] = dp[i][m - i][1] = 1;
  for (long long len = m - 1; len >= 0; len--) {
    for (long long i = 0; i <= len; i++) {
      long long j = len - i, inv;
      if (s2 - j < 0) continue;
      inv = m_pow(s1 + s2 + i - j, 998244353 - 2);
      add(dp[i][j][0],
          (s1 + i + 1) * inv % 998244353 * dp[i + 1][j][0] % 998244353);
      add(dp[i][j][0],
          (s2 - j) * inv % 998244353 * dp[i][j + 1][0] % 998244353);
      if (s2 - j <= 0) continue;
      add(dp[i][j][1],
          (s1 + i) * inv % 998244353 * dp[i + 1][j][1] % 998244353);
      add(dp[i][j][1],
          (s2 - j - 1) * inv % 998244353 * dp[i][j + 1][1] % 998244353);
    }
  }
  for (long long i = 1; i <= n; i++)
    printf("%lld\n",
           w[i] * ((a[i] == 1) ? dp[0][0][0] : dp[0][0][1]) % 998244353);
}
