#include <bits/stdc++.h>
const int N = 3005, mu = 998244353;
int n, m, a[200005], w[200005], f[N][N], sum, A, B, g[N][N];
int ksm(int x, int y) {
  int ans = 1;
  for (; y; y >>= 1, x = (long long)x * x % mu)
    if (y & 1) ans = (long long)ans * x % mu;
  return ans;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    sum += w[i];
    scanf("%d", &w[i]);
    if (a[i] == 1)
      A += w[i];
    else
      B += w[i];
  }
  for (int i = 0; i <= m; i++) f[m][i] = 1, g[m][i] = 1;
  for (int i = m - 1; i >= 0; i--) {
    for (int j = 0; j <= i; j++) {
      int SA = A + j, SB = B - (i - j);
      if (SA < 0 || SB < 0) continue;
      int iv = ksm(SA + SB, mu - 2);
      f[i][j] = ((long long)(SA + 1) * f[i + 1][j + 1] % mu +
                 (long long)SB * f[i + 1][j]) %
                mu;
      f[i][j] = (long long)f[i][j] * iv % mu;
      g[i][j] = ((long long)SA * g[i + 1][j + 1] % mu +
                 (long long)(SB - 1) * g[i + 1][j]) %
                mu;
      g[i][j] = (long long)g[i][j] * iv % mu;
    }
  }
  for (int i = 1; i <= n; i++)
    printf("%d ", (long long)w[i] * (a[i] ? f[0][0] : g[0][0]) % mu);
}
