#include <bits/stdc++.h>
using namespace std;
int dp[102][55][55][55][2];
long long w[55];
long long a[55];
long long sa, sb;
long long n, m;
const long long MOD = 998244353;
long long funct(long long x) {
  long long answer = 1, current = x;
  long long p = MOD - 2;
  while (p != 0) {
    if (p % 2 != 0) {
      answer = (answer * current) % MOD;
    }
    p /= 2;
    current = (current * current) % MOD;
  }
  return answer;
}
long long solve(long long w, long long x, long long y, long long pos,
                long long u) {
  if (pos == m) return w;
  if (w == 0) return 0;
  if (dp[w][x][y][pos][u] != -1) return dp[w][x][y][pos][u];
  long long ans = 0;
  long long sumBad = -y + sb;
  long long sumGood = x + sa;
  if (u == 1) sumGood -= w;
  if (u == 0) sumBad -= w;
  if (sumBad != 0)
    ans += (((sumBad * funct(sumBad + sumGood + w)) % MOD) *
            solve(w, x, y + 1, pos + 1, u)) %
           MOD;
  if (sumGood != 0)
    ans += (((sumGood * funct(sumBad + sumGood + w)) % MOD) *
            solve(w, x + 1, y, pos + 1, u)) %
           MOD;
  if (w != 0) {
    if (u == 0) {
      ans += (((w * funct(sumGood + sumBad + w)) % MOD) *
              solve(w - 1, x, y + 1, pos + 1, u)) %
             MOD;
    }
    if (u == 1) {
      ans += (((w * funct(sumGood + sumBad + w)) % MOD) *
              solve(w + 1, x + 1, y, pos + 1, u)) %
             MOD;
    }
  }
  ans %= MOD;
  dp[w][x][y][pos][u] = ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  long long i, j;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) {
    cin >> w[i];
    sa += a[i] * w[i];
    sb += (1 - a[i]) * w[i];
  }
  memset(dp, -1, sizeof(dp));
  for (i = 1; i <= n; i++) {
    cout << solve(w[i], 0, 0, 0, a[i]) << endl;
  }
}
