#include <bits/stdc++.h>
using namespace std;
const int MAXN = 205;
const int P = 998244353;
template <typename T>
void chkmax(T &x, T y) {
  x = max(x, y);
}
template <typename T>
void chkmin(T &x, T y) {
  x = min(x, y);
}
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  x *= f;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
int a[MAXN], w[MAXN];
int dp[MAXN][MAXN], binom[MAXN][MAXN];
int power(int x, int y) {
  if (y == 0) return 1;
  int tmp = power(x, y / 2);
  if (y % 2 == 0)
    return 1ll * tmp * tmp % P;
  else
    return 1ll * tmp * tmp % P * x % P;
}
int getdown(int x, int y) {
  int ans = 1;
  for (int i = 1; i <= y; i++) ans = 1ll * ans * (x - i + 1) % P;
  return ans;
}
int getup(int x, int y) {
  int ans = 1;
  for (int i = 1; i <= y; i++) ans = 1ll * ans * (x + i - 1) % P;
  return ans;
}
void update(int &x, int y) {
  x += y;
  if (x >= P) x -= P;
}
int main() {
  int n, m;
  read(n), read(m);
  for (int i = 1; i <= n; i++) read(a[i]);
  int s = 0, g = 0, b = 0;
  for (int i = 1; i <= n; i++) {
    read(w[i]), s += w[i];
    if (a[i] == 0)
      b += w[i];
    else
      g += w[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i <= m - 1; i++) {
    for (int j = 0; j <= i; j++) {
      int tmp = dp[i][j], cnt = s + j - (i - j);
      update(dp[i + 1][j],
             1ll * tmp * (b - (i - j)) % P * power(cnt, P - 2) % P);
      update(dp[i + 1][j + 1], 1ll * tmp * (g + j) % P * power(cnt, P - 2) % P);
    }
  }
  for (int i = 0; i <= m; i++) {
    binom[i][0] = 1;
    for (int j = 1; j <= i; j++)
      binom[i][j] = (binom[i - 1][j - 1] + binom[i - 1][j]) % P;
  }
  for (int i = 1; i <= n; i++) {
    int ans = w[i];
    if (a[i] == 0) {
      for (int j = 0; j <= m; j++) {
        if (dp[m][m - j] == 0) continue;
        int tmp = dp[m][m - j];
        for (int k = 0; k <= j; k++)
          update(ans, P - 1ll * tmp * k % P * getdown(w[i], k) % P *
                              getdown(b - w[i], j - k) % P * binom[j][k] % P *
                              power(getdown(b, j), P - 2) % P);
      }
    } else {
      for (int j = 0; j <= m; j++) {
        if (dp[m][j] == 0) continue;
        int tmp = dp[m][j];
        for (int k = 0; k <= j; k++)
          update(ans, 1ll * tmp * k % P * getup(w[i], k) % P *
                          getup(g - w[i], j - k) % P * binom[j][k] % P *
                          power(getup(g, j), P - 2) % P);
      }
    }
    writeln(ans);
  }
  return 0;
}
