#include <bits/stdc++.h>
using namespace std;
long long read(long long x = 0) {
  int c, f = 1;
  for (c = getchar(); !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
  return f * x;
}
long long N, M, f[55][55][55], good, bad, tot, w[55], inv[300010], a[300010];
int main() {
  long long i, j, k, num;
  N = read(), M = read();
  for (i = 1; i <= N; i++) a[i] = read();
  for (i = 1; i <= N; i++) {
    w[i] = read();
    tot += w[i];
    if (a[i] == 0)
      bad += w[i];
    else
      good += w[i];
  }
  inv[1] = 1;
  for (i = 2; i < 300010; i++)
    inv[i] =
        inv[998244353ll % i] * (998244353ll - 998244353ll / i) % 998244353ll;
  for (num = 1; num <= N; num++) {
    memset(f, 0, sizeof(f));
    long long ans(0);
    f[0][0][0] = 1;
    for (i = 0; i <= M; i++)
      for (j = 0; j <= M; j++)
        for (k = 0; k <= M; k++) {
          if (f[i][j][k] == 0) continue;
          if (i == M) {
            if (a[num] == 0) {
              ans = (ans + f[i][j][k] * (w[num] - j)) % 998244353ll;
            } else {
              ans = (ans + f[i][j][k] * (w[num] + j)) % 998244353ll;
            }
          }
          if (a[num] == 0) {
            f[i + 1][j][k + 1] += f[i][j][k] * inv[tot - k + i - k] %
                                  998244353ll * (bad - k - (w[num] - j)) %
                                  998244353ll;
            f[i + 1][j][k + 1] %= 998244353ll;
            f[i + 1][j + 1][k + 1] += f[i][j][k] * inv[tot - k + i - k] %
                                      998244353ll * (w[num] - j) % 998244353ll;
            f[i + 1][j + 1][k + 1] %= 998244353ll;
            f[i + 1][j][k] += f[i][j][k] * inv[tot - k + i - k] % 998244353ll *
                              (good + (i - k));
            f[i + 1][j][k] %= 998244353ll;
          } else {
            f[i + 1][j][k + 1] += f[i][j][k] * inv[tot - k + i - k] %
                                  998244353ll * (bad - k) % 998244353ll;
            f[i + 1][j][k + 1] %= 998244353ll;
            f[i + 1][j][k] += f[i][j][k] * inv[tot - k + i - k] % 998244353ll *
                              (good + (i - k) - (w[num] + j));
            f[i + 1][j][k] %= 998244353ll;
            f[i + 1][j + 1][k] +=
                f[i][j][k] * inv[tot - k + i - k] % 998244353ll * (w[num] + j);
            f[i + 1][j + 1][k] %= 998244353ll;
          }
        }
    printf("%lld\n", ans);
  }
  return 0;
}
