#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int n, m;
int a[51];
int w[51];
int dp[51][51][51][51][2];
int add = 0, sub = 0;
int ip[2551];
int power(int x, int y) {
  if (y == 0) return 1;
  int a = power(x, y / 2);
  a = (1LL * a * a) % mod;
  if (y % 2) a = (1LL * a * x) % mod;
  return a;
}
int solve(int turns, int ini, int x, int pos, int type) {
  if (turns == 0) {
    if (type)
      return (ini + x);
    else
      return (ini - x);
  }
  if (type == 0 && ini == x) return 0;
  if (dp[turns][ini][x][pos][type] != -1) return dp[turns][ini][x][pos][type];
  dp[turns][ini][x][pos][type] = 0;
  int net = add + sub + pos - (m - turns - pos);
  int p;
  if (type)
    p = (1LL * (ini + x) * ip[net]) % mod;
  else
    p = (1LL * (ini - x) * ip[net]) % mod;
  if (type)
    dp[turns][ini][x][pos][type] +=
        (1LL * p * solve(turns - 1, ini, x + 1, pos + 1, type)) % mod;
  else
    dp[turns][ini][x][pos][type] +=
        (1LL * p * solve(turns - 1, ini, x + 1, pos, type)) % mod;
  dp[turns][ini][x][pos][type] %= mod;
  if (type) {
    int p1 = (1LL * (add + pos - ini - x) * ip[net]) % mod;
    dp[turns][ini][x][pos][type] +=
        (1LL * p1 * solve(turns - 1, ini, x, pos + 1, type)) % mod;
    dp[turns][ini][x][pos][type] %= mod;
    p1 = (1LL * (sub - (m - turns - pos)) * ip[net]) % mod;
    dp[turns][ini][x][pos][type] +=
        (1LL * p1 * solve(turns - 1, ini, x, pos, type)) % mod;
    dp[turns][ini][x][pos][type] %= mod;
  } else {
    int p1 = (1LL * (add + pos) * ip[net]) % mod;
    dp[turns][ini][x][pos][type] +=
        (1LL * p1 * solve(turns - 1, ini, x, pos + 1, type)) % mod;
    dp[turns][ini][x][pos][type] %= mod;
    p1 = (1LL * (sub - (m - turns - pos) - (ini - x)) * ip[net]) % mod;
    dp[turns][ini][x][pos][type] +=
        (1LL * p1 * solve(turns - 1, ini, x, pos, type)) % mod;
    dp[turns][ini][x][pos][type] %= mod;
  }
  return dp[turns][ini][x][pos][type];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = int(1); i <= int(n); i++) cin >> a[i];
  for (int i = int(1); i <= int(n); i++) {
    cin >> w[i];
    if (a[i])
      add += w[i];
    else
      sub += w[i];
  }
  ip[0] = 0;
  for (int i = int(1); i <= int(2550); i++) ip[i] = power(i, mod - 2);
  memset(dp, -1, sizeof(dp));
  for (int i = int(1); i <= int(n); i++)
    cout << solve(m, w[i], 0, 0, a[i]) << "\n";
}
