#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const long long inf = 998244353;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f * x;
}
int n, m, a[105], b[105], tot, _x, _y, _t;
long long d[2][105][105], inv[100005];
void solve(int t) {
  memset(d, 0, sizeof(d));
  d[_t][b[t]][m] = 1;
  for (int i = 0; i <= m - 1; i++) {
    for (int j = 0; j <= m + b[t]; j++)
      for (int k = 0; k <= m << 1; k++)
        if (d[_t][j][k]) {
          int y = (i + m - k) / 2;
          int x = i - y;
          if (a[t]) {
            if (_x + x < j) continue;
            (d[_t ^ 1][j + 1][k + 1] +=
             d[_t][j][k] * j % inf * inv[tot + k - m] % inf) %= inf;
            (d[_t ^ 1][j][k + 1] +=
             d[_t][j][k] * (_x + x - j) % inf * inv[tot + k - m] % inf) %= inf;
            if (k)
              (d[_t ^ 1][j][k - 1] +=
               d[_t][j][k] * (_y - y) % inf * inv[tot + k - m] % inf) %= inf;
          } else {
            if (_y + y < j) continue;
            if (j)
              (d[_t ^ 1][j - 1][k - 1] +=
               d[_t][j][k] * j % inf * inv[tot + k - m] % inf) %= inf;
            (d[_t ^ 1][j][k + 1] +=
             d[_t][j][k] * (_x + x) % inf * inv[tot + k - m] % inf) %= inf;
            if (k)
              (d[_t ^ 1][j][k - 1] += d[_t][j][k] * (_y - y - j) % inf *
                                      inv[tot + k - m] % inf) %= inf;
          }
        }
    memset(d[_t], 0, sizeof(d[_t]));
    _t ^= 1;
  }
  long long ans = 0;
  for (int j = 0; j <= m + b[t]; j++)
    for (int k = 0; k <= m << 1; k++) ans += d[_t][j][k] * j % inf, ans %= inf;
  printf("%lld\n", ans);
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) b[i] = read();
  inv[1] = 1;
  for (int i = 2; i <= 100000; i++)
    inv[i] = inv[inf % i] * (inf - inf / i) % inf;
  for (int i = 1; i <= n; i++)
    if (a[i])
      _x += b[i];
    else
      _y += b[i];
  for (int i = 1; i <= n; i++) tot += b[i];
  for (int i = 1; i <= n; i++) {
    solve(i);
  }
}
