#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 998244353, N = 56, M = 2 * N, C = 5005;
int a[N], b[N], memo[C][C];
int dp[M][M][M][2];
int sumA, sumB;
void add(int& a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
ll binPow(ll x, ll y) {
  ll ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % MOD;
    x = x * x % MOD;
    y >>= 1;
  }
  return ans;
}
int calc(int move, int x, int y, int p) {
  if (x < 0 || y < 0 || x >= M || y >= M) return 0;
  if (move == 0) return 1;
  int sA = sumA + x - N, sB = sumB + y - N;
  if (sA < 0 || sB < 0) return 0;
  if (sA >= 1 && p == 0) {
    int& dp0 = dp[move][x][y][0];
    if (~dp0) return dp0;
    dp0 = 0;
    int opt0 = memo[1][sA + sB];
    if (x + 1 < M) {
      add(dp0, (ll)opt0 * calc(move - 1, x + 1, y, 0) * 2 % MOD);
    }
    int opt1 = memo[sA - 1][sA + sB];
    if (x + 1 < M) {
      add(dp0, (ll)opt1 * calc(move - 1, x + 1, y, 0) % MOD);
    }
    int opt2 = memo[sB][sA + sB];
    if (y > 0) {
      add(dp0, (ll)opt2 * calc(move - 1, x, y - 1, 0) % MOD);
    }
    return dp0;
  }
  if (sB >= 1 && p == 1) {
    int& dp1 = dp[move][x][y][1];
    if (~dp1) return dp1;
    dp1 = 0;
    int opt1 = memo[sB - 1][sA + sB];
    if (y > 0) {
      add(dp1, (ll)opt1 * calc(move - 1, x, y - 1, 1) % MOD);
    }
    int opt2 = memo[sA][sA + sB];
    if (x + 1 < M) {
      add(dp1, (ll)opt2 * calc(move - 1, x + 1, y, 1) % MOD);
    }
    return dp1;
  }
  return 0;
}
int f(int move, int x, int y, int me, int p) {
  return (ll)calc(move, x, y, p) * me % MOD;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) cin >> b[i];
  for (int i = 1; i <= n; ++i) {
    sumA += a[i] * b[i];
    sumB += (!a[i]) * b[i];
  }
  for (int i = 0; i < C; ++i) {
    ll save = binPow(i, MOD - 2);
    for (int j = 0; j <= i; ++j) {
      memo[j][i] = j * save % MOD;
    }
  }
  memset(dp, -1, sizeof dp);
  for (int i = 1; i <= n; ++i) {
    cout << f(m, N, N, b[i], !a[i]) << '\n';
  }
}
