#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
inline int read() {
  int x = 0, f = 1, c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == 45) f ^= 1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
  return f ? x : -x;
}
int qp(int x, int n) {
  return !n ? 1 : 1LL * qp(1LL * x * x % mod, n >> 1) * (n & 1 ? x : 1) % mod;
}
int inv(int x) { return qp(x, mod - 2); }
int n, m;
int a[55], w[55];
int dp[55][55][55][55];
int main() {
  n = read(), m = read();
  for (int i = 0; i < (int)(n); ++i) a[i] = read();
  int sum = 0, like = 0;
  for (int i = 0; i < (int)(n); ++i)
    w[i] = read(), sum += w[i], like += w[i] * a[i];
  for (int i = 0; i < (int)(n); ++i) dp[0][0][i][0] = 1;
  for (int i = 0; i < (int)(m); ++i)
    for (int j = 0; j < (int)(i + 1); ++j) {
      int nwsum = sum + j - (i - j);
      int invnwsum = inv(nwsum);
      for (int k = 0; k < (int)(n); ++k)
        for (int l = 0; l < (int)(i + 1); ++l) {
          if (!dp[i][j][k][l]) continue;
          int nwlike = like + j;
          for (int sel = 0; sel < (int)(2); ++sel) {
            int nj = j + sel;
            int ful = sel ? nwlike : nwsum - nwlike;
            int nwk = l * (a[k] ? 1 : -1) + w[k];
            if (nwk <= 0) continue;
            if (sel == a[k]) ful -= nwk;
            (dp[i + 1][nj][k][l] +=
             1LL * dp[i][j][k][l] * ful % mod * invnwsum % mod) %= mod;
            if (sel == a[k])
              (dp[i + 1][nj][k][l + 1] +=
               1LL * dp[i][j][k][l] * nwk % mod * invnwsum % mod) %= mod;
          }
        }
    }
  for (int i = 0; i < (int)(n); ++i) {
    int ans = 0;
    for (int j = 0; j < (int)(m + 1); ++j)
      for (int l = 0; l < (int)(m + 1); ++l) {
        (ans += 1LL * (l * (a[i] ? 1 : -1) + w[i]) * dp[m][j][i][l] % mod) %=
            mod;
      }
    printf("%d\n", ans);
  }
  return 0;
}
