#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long pow_mod(long long a, long long p) {
  if (p == 0) return 1;
  long long ret = pow_mod(a, p / 2);
  ret = ret * ret % mod;
  if (p % 2 == 1) ret = ret * a % mod;
  return ret;
}
long long _inv(long long a) { return pow_mod(a, mod - 2); }
long long dp[55][55][55], inv[3005];
int w[55], a[55];
int main() {
  inv[0] = 1;
  for (int i = 1; i < 3005; i++) inv[i] = _inv(i);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> w[i];
  int like = 0, dislike = 0, tot = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0)
      dislike += w[i];
    else
      like += w[i];
    tot += w[i];
  }
  for (int i = 1; i <= n; i++) {
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    for (int j = 0; j < m; j++)
      for (int k = 0; k <= j; k++)
        for (int l = 0; l <= j; l++) {
          int cur = tot + 2 * l - j;
          if (cur < 0) continue;
          if (a[i] == 1) {
            int p1 = w[i] + k;
            int p2 = like + l - w[i] - k;
            int p3 = cur - like - l;
            dp[j + 1][k + 1][l + 1] =
                (dp[j + 1][k + 1][l + 1] +
                 dp[j][k][l] * p1 % mod * inv[cur] % mod) %
                mod;
            dp[j + 1][k][l + 1] = (dp[j + 1][k][l + 1] +
                                   dp[j][k][l] * p2 % mod * inv[cur] % mod) %
                                  mod;
            dp[j + 1][k][l] =
                (dp[j + 1][k][l] + dp[j][k][l] * p3 % mod * inv[cur] % mod) %
                mod;
          } else if (a[i] == 0 && k <= w[i] && (j - l) <= dislike) {
            int p1 = w[i] - k;
            int p2 = dislike - (j - l) - (w[i] - k);
            int p3 = cur - dislike + (j - l);
            dp[j + 1][k + 1][l] = (dp[j + 1][k + 1][l] +
                                   dp[j][k][l] * p1 % mod * inv[cur] % mod) %
                                  mod;
            dp[j + 1][k][l] =
                (dp[j + 1][k][l] + dp[j][k][l] * p2 % mod * inv[cur] % mod) %
                mod;
            dp[j + 1][k][l + 1] = (dp[j + 1][k][l + 1] +
                                   dp[j][k][l] * p3 % mod * inv[cur] % mod) %
                                  mod;
          }
        }
    long long ans = 0;
    for (int k = 0; k <= m; k++)
      for (int l = 0; l <= m; l++) {
        if (a[i] == 1)
          ans = (ans + dp[m][k][l] * (w[i] + k)) % mod;
        else if (k <= w[i])
          ans = (ans + dp[m][k][l] * (w[i] - k)) % mod;
      }
    cout << ans << endl;
  }
  return 0;
}
