#include <bits/stdc++.h>
using namespace std;
int64_t mod = 998244353;
int64_t mod1 = 1e9 + 5;
int64_t power(int64_t a, int64_t b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return power(((((a) % mod) * ((a) % mod)) % mod), b / 2) % mod;
  else
    return (((a) % mod) *
            (power(((((a) % mod) * ((a) % mod)) % mod), b / 2) % mod)) %
           mod;
}
inline int64_t inverse(int64_t a) {
  a %= mod;
  if (a < 0) a += mod;
  int64_t b = mod, u = 0, v = 1;
  while (a) {
    int64_t t = b / a;
    b -= t * a;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += mod;
  return u;
}
const int64_t ce = 1e9 + 7;
int64_t fast_mod(int64_t input) { return input < ce ? input : input % ce; }
int64_t full, toti, toti1;
int64_t n, m;
int64_t x;
int64_t ch;
int64_t dp[50][101][51][51];
int64_t solve(int64_t i, int64_t we, int64_t fav, int64_t fav1) {
  if (i == m) {
    return we;
  }
  int64_t &res = dp[i][we][fav][fav1];
  if (res != -1) return res;
  int64_t tot = full;
  tot += fav;
  tot -= fav1;
  tot -= x;
  tot += we;
  res = 0;
  if (toti > 0)
    res +=
        ((toti + fav) * inverse(tot)) % mod * solve(i + 1, we, fav + 1, fav1);
  res %= mod;
  if (ch)
    res += (we * inverse(tot)) % mod * solve(i + 1, we + 1, fav, fav1);
  else if (we > 0)
    res += (we * inverse(tot)) % mod * solve(i + 1, we - 1, fav, fav1);
  res %= mod;
  if (toti1 - fav1 > 0)
    res += (max((toti1 - fav1), (int64_t)0) * inverse(tot)) % mod *
           solve(i + 1, we, fav, fav1 + 1);
  res %= mod;
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  int64_t a[n + 1];
  for (int64_t i = 1; i <= n; i++) cin >> a[i];
  full = 0;
  toti = 0;
  toti1 = 0;
  int64_t w[n + 1];
  for (int64_t i = 1; i <= n; i++) {
    cin >> w[i];
    full += w[i];
    if (a[i])
      toti += w[i];
    else
      toti1 += w[i];
  }
  for (int64_t i = 1; i <= n; i++) {
    if (a[i]) {
      toti -= w[i];
    } else {
      toti1 -= w[i];
    }
    if (a[i])
      ch = 1;
    else
      ch = 0;
    x = w[i];
    memset(dp, -1, sizeof(dp));
    cout << solve(0, w[i], 0, 0) << '\n';
    if (a[i]) {
      toti += w[i];
    } else {
      toti1 += w[i];
    }
  }
}
