#include <bits/stdc++.h>
using namespace std;
const int mxn = 262144, md = 998244353;
int rd() {
  int x = 0, flg = 1;
  char c = getchar();
  for (; (c < 48 || c > 57) && c != '-'; c = getchar())
    ;
  if (c == '-') flg = -1, c = getchar();
  for (; c > 47 && c < 58; x = x * 10 + c - 48, c = getchar())
    ;
  return x * flg;
}
int power(int x, int p, int num = 1) {
  for (; p; p >>= 1, x = 1ll * x * x % md)
    if (p & 1) num = 1ll * num * x % md;
  return num;
}
int n, m, sa, sb, tg[64], f[2][64][64][128], inv[16384];
int main() {
  n = rd(), m = rd();
  for (int i = 1; i <= n; ++i) tg[i] = rd();
  for (int i = 1, x; i <= n; ++i)
    x = rd(), f[0][i][0][x] = 1, sa += tg[i] * x, sb += (!tg[i]) * x;
  bool cur = 0;
  for (int t = 0; t < m; ++t) {
    cur ^= 1;
    memset(f[cur], 0, sizeof(f[cur]));
    for (int i = 1; i <= n; ++i)
      if (tg[i])
        for (int j = 0; j <= t; ++j) {
          int inv = power(sa + sb - t + 2 * j, md - 2);
          for (int k = 0; k <= 100; ++k)
            if (f[cur ^ 1][i][j][k]) {
              f[cur][i][j + 1][k + 1] =
                  (f[cur][i][j + 1][k + 1] +
                   1ll * f[cur ^ 1][i][j][k] * k % md * inv) %
                  md;
              f[cur][i][j + 1][k] =
                  (f[cur][i][j + 1][k] +
                   1ll * f[cur ^ 1][i][j][k] * (sa + j - k) % md * inv) %
                  md;
              f[cur][i][j][k] =
                  (f[cur][i][j][k] +
                   1ll * f[cur ^ 1][i][j][k] * (sb - t + j) % md * inv) %
                  md;
            }
        }
      else
        for (int j = 0; j <= t; ++j) {
          int inv = power(sa + sb - t + 2 * j, md - 2);
          for (int k = 0; k <= 100; ++k)
            if (f[cur ^ 1][i][j][k]) {
              f[cur][i][j][k - 1] = (f[cur][i][j][k - 1] +
                                     1ll * f[cur ^ 1][i][j][k] * k % md * inv) %
                                    md;
              f[cur][i][j][k] =
                  (f[cur][i][j][k] +
                   1ll * f[cur ^ 1][i][j][k] * (sb - t + j - k) % md * inv) %
                  md;
              f[cur][i][j + 1][k] =
                  (f[cur][i][j + 1][k] +
                   1ll * f[cur ^ 1][i][j][k] * (sa + j) % md * inv) %
                  md;
            }
        }
  }
  for (int i = 1; i <= n; ++i) {
    int ans = 0;
    for (int j = 0; j <= m; ++j)
      for (int k = 0; k <= 100; ++k)
        ans = (ans + 1ll * f[cur][i][j][k] * k) % md;
    printf("%d\n", ans);
  }
  return 0;
}
