#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
inline long long pow_mod(long long x, long long i) {
  long long y = 1;
  while (i) {
    if (i & 1) y = y * x % MOD;
    x = x * x % MOD;
    i >>= 1;
  }
  return y;
}
inline long long get_inv(long long x) { return pow_mod(x, MOD - 2); }
long long dp[51][51][51], a[51], w[51];
int n, m;
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  long long s1 = 0, s2 = 0, sum = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> w[i];
    sum += w[i];
    if (a[i])
      s1 += w[i];
    else
      s2 += w[i];
  }
  for (int t = 1; t <= n; ++t) {
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    for (int i = 0; i < m; ++i) {
      for (int j = 0; j <= i; ++j) {
        long long cursum = sum + j - (i - j);
        long long ivs = get_inv(cursum);
        for (int k = 0; k <= i; ++k) {
          ;
          if ((a[t] && k > j) || (!a[t] && k > (i - j))) break;
          if (!dp[i][j][k]) continue;
          long long curw = (w[t] + k * (a[t] ? 1 : -1) + MOD) % MOD;
          if (a[t]) {
            dp[i + 1][j + 1][k + 1] = (dp[i + 1][j + 1][k + 1] +
                                       curw * ivs % MOD * dp[i][j][k] % MOD) %
                                      MOD;
            dp[i + 1][j + 1][k] =
                (dp[i + 1][j + 1][k] +
                 (long long)(s1 + j - curw) * ivs % MOD * dp[i][j][k] % MOD) %
                MOD;
            dp[i + 1][j][k] =
                (dp[i + 1][j][k] +
                 (long long)(s2 - (i - j)) * ivs % MOD * dp[i][j][k] % MOD) %
                MOD;
          } else {
            dp[i + 1][j][k + 1] =
                (dp[i + 1][j][k + 1] + curw * ivs % MOD * dp[i][j][k] % MOD) %
                MOD;
            dp[i + 1][j][k] =
                (dp[i + 1][j][k] + (long long)(s2 - (i - j) - curw) * ivs %
                                       MOD * dp[i][j][k] % MOD) %
                MOD;
            dp[i + 1][j + 1][k] =
                (dp[i + 1][j + 1][k] +
                 (long long)(s1 + j) * ivs % MOD * dp[i][j][k] % MOD) %
                MOD;
          }
        }
      }
    }
    long long expect = 0;
    for (int j = 0; j <= m; ++j) {
      for (int k = 0; k <= m; ++k) {
        expect =
            (expect + dp[m][j][k] * (w[t] + k * (a[t] ? 1 : -1)) % MOD) % MOD;
      }
    }
    cout << expect << endl;
  }
  return 0;
}
