#include <bits/stdc++.h>
using namespace std;
const int MAXN = 55;
const long long mod = 998244353;
int n, m;
int sum[2];
int a[MAXN], w[MAXN];
int memo[MAXN * 2][MAXN][MAXN][MAXN][2];
long long fastPow(long long x, long long p) {
  long long answer = 1, current = x;
  while (p != 0) {
    if (p % 2 != 0) {
      answer = (answer * current) % mod;
    }
    p /= 2;
    current = (current * current) % mod;
  }
  return answer;
}
long long inv(long long x) { return fastPow(x, mod - 2); }
long long calcState(int curr, int diffGood, int diffBad, int turn, bool type) {
  if (curr == 0) return 0;
  if (turn == m) return curr;
  if (memo[curr][diffGood][diffBad][turn][type] != -1) {
    return memo[curr][diffGood][diffBad][turn][type];
  }
  int sumBad = sum[0] - diffBad;
  int sumGood = sum[1] + diffGood;
  if (type == false)
    sumBad -= curr;
  else if (type == true)
    sumGood -= curr;
  long long answer = 0;
  if (sumBad != 0)
    answer += (((sumBad * inv(sumBad + sumGood + curr)) % mod) *
               calcState(curr, diffGood, diffBad + 1, turn + 1, type)) %
              mod;
  if (sumGood != 0)
    answer += (((sumGood * inv(sumBad + sumGood + curr)) % mod) *
               calcState(curr, diffGood + 1, diffBad, turn + 1, type)) %
              mod;
  if (curr != 0) {
    if (type == false) {
      answer += (((curr * inv(sumBad + sumGood + curr)) % mod) *
                 calcState(curr - 1, diffGood, diffBad + 1, turn + 1, type)) %
                mod;
    } else {
      answer += (((curr * inv(sumBad + sumGood + curr)) % mod) *
                 calcState(curr + 1, diffGood + 1, diffBad, turn + 1, type)) %
                mod;
    }
  }
  answer %= mod;
  memo[curr][diffGood][diffBad][turn][type] = answer;
  return answer;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  for (int i = 0; i < n; i++) {
    sum[a[i]] += w[i];
  }
  memset(memo, -1, sizeof(memo));
  for (int i = 0; i < n; i++) {
    cout << calcState(w[i], 0, 0, 0, a[i]) << '\n';
  }
}
