#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
const long long mod = 998244353;
const double eps = (double)1e-9;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 300500;
long long rev[N];
int n, m, a[N], w[N], W, B;
long long dp[51][101][51][51];
long long bp(long long x, long long y) {
  long long z = 1;
  while (y) {
    if (y & 1) z = z * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return z;
}
int main() {
  for (int i = 0; i <= 100000; ++i) rev[i] = bp(i, mod - 2) % mod;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) {
    cin >> w[i];
    if (a[i])
      W += w[i];
    else
      B += w[i];
  }
  for (int i = 1; i <= n; ++i) {
    memset(dp, 0, sizeof dp);
    dp[0][w[i]][0][0] = 1;
    if (a[i]) {
      for (int j = 0; j < m; ++j)
        for (int nice = 0; nice < 50; nice++)
          for (int bad = 0; bad < 50; ++bad)
            for (int we = w[i]; we <= w[i] + 50; we++) {
              if (dp[j][we][nice][bad] == 0) continue;
              int Total = W + B + nice - bad;
              dp[j + 1][we][nice + 1][bad] =
                  (dp[j + 1][we][nice + 1][bad] + dp[j][we][nice][bad] *
                                                      (W + nice - we) % mod *
                                                      rev[Total] % mod) %
                  mod;
              dp[j + 1][we + 1][nice + 1][bad] =
                  (dp[j + 1][we + 1][nice + 1][bad] +
                   dp[j][we][nice][bad] * we % mod * rev[Total] % mod) %
                  mod;
              if (B - bad > 0)
                dp[j + 1][we][nice][bad + 1] =
                    (dp[j + 1][we][nice][bad + 1] + dp[j][we][nice][bad] *
                                                        (B - bad) % mod *
                                                        rev[Total] % mod) %
                    mod;
            }
    } else {
      for (int j = 0; j < m; ++j)
        for (int nice = 0; nice < 50; nice++)
          for (int bad = 0; bad < 50; ++bad)
            for (int we = 0; we <= w[i]; we++) {
              if (dp[j][we][nice][bad] == 0) continue;
              int Total = W + B + nice - bad;
              dp[j + 1][we][nice + 1][bad] =
                  (dp[j + 1][we][nice + 1][bad] +
                   dp[j][we][nice][bad] * (W + nice) % mod * rev[Total] % mod) %
                  mod;
              if (we > 0 && B - bad > 0)
                dp[j + 1][we - 1][nice][bad + 1] =
                    (dp[j + 1][we - 1][nice][bad + 1] +
                     dp[j][we][nice][bad] * we % mod * rev[Total] % mod) %
                    mod;
              if (B - bad - we > 0)
                dp[j + 1][we][nice][bad + 1] =
                    (dp[j + 1][we][nice][bad + 1] + dp[j][we][nice][bad] *
                                                        (B - bad - we) % mod *
                                                        rev[Total] % mod) %
                    mod;
            }
    }
    long long ans = 0;
    for (int we = 0; we <= 100; ++we)
      for (int bad = 0; bad <= 50; ++bad)
        for (int nice = 0; nice <= 50; ++nice)
          ans = (ans + we * dp[m][we][nice][bad] % mod) % mod;
    cout << ans << endl;
  }
  return 0;
}
