#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long i, i0, n, m, a[55], w[55], dp[55][55][55][55], dic[3055],
    ddic[3055][3055];
long long inv(long long b) {
  return b == 1 ? 1 : (mod - mod / b) * inv(mod % b) % mod;
}
int main() {
  for (i = 1; i <= 3050; i++) dic[i] = inv(i);
  for (i = 1; i <= 3050; i++) {
    for (i0 = 1; i0 <= i; i0++) {
      ddic[i0][i] = i0 * dic[i] % mod;
    }
  }
  scanf("%lld %lld", &n, &m);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  long long sum0 = 0, sum1 = 0;
  for (i = 1; i <= n; i++) {
    scanf("%lld", &w[i]);
    if (a[i])
      sum1 += w[i];
    else
      sum0 += w[i];
  }
  for (i = 1; i <= n; i++) {
    if (a[i]) {
      memset(dp, 0, sizeof(dp));
      dp[0][0][0][0] = 1;
      for (i0 = 0; i0 < m; i0++) {
        for (int ia = 0; ia <= m; ia++) {
          for (int ib = 0; ib + ia <= m; ib++) {
            for (int ic = 0; ia + ib + ic <= m && ic <= sum0; ic++) {
              dp[i0 + 1][ia + 1][ib][ic] +=
                  dp[i0][ia][ib][ic] *
                  ddic[w[i] + ia][sum0 + sum1 + ia + ib - ic];
              dp[i0 + 1][ia][ib + 1][ic] +=
                  dp[i0][ia][ib][ic] *
                  ddic[sum1 + ib - w[i]][sum0 + sum1 + ia + ib - ic];
              dp[i0 + 1][ia][ib][ic + 1] +=
                  dp[i0][ia][ib][ic] *
                  ddic[sum0 - ic][sum0 + sum1 + ia + ib - ic];
              dp[i0 + 1][ia + 1][ib][ic] %= mod;
              dp[i0 + 1][ia][ib + 1][ic] %= mod;
              dp[i0 + 1][ia][ib][ic + 1] %= mod;
            }
          }
        }
      }
      long long ans = 0;
      for (int ia = 0; ia <= m; ia++) {
        for (int ib = 0; ib + ia <= m; ib++) {
          for (int ic = 0; ic + ia + ib <= m && ic <= sum0; ic++) {
            ans += (ia + w[i]) * dp[m][ia][ib][ic];
            ans %= mod;
          }
        }
      }
      printf("%lld\n", ans);
    } else {
      memset(dp, 0, sizeof(dp));
      dp[0][0][0][0] = 1;
      for (i0 = 0; i0 < m; i0++) {
        for (int ia = 0; ia <= w[i] && ia <= m; ia++) {
          for (int ib = 0; ib + ia <= m; ib++) {
            for (int ic = 0; ic + ib + ia <= m && ic <= sum0 - w[i]; ic++) {
              dp[i0 + 1][ia + 1][ib][ic] +=
                  dp[i0][ia][ib][ic] *
                  ddic[w[i] - ia][sum0 + sum1 - ia + ib - ic];
              dp[i0 + 1][ia][ib + 1][ic] +=
                  dp[i0][ia][ib][ic] *
                  ddic[sum1 + ib][sum0 + sum1 - ia + ib - ic];
              dp[i0 + 1][ia][ib][ic + 1] +=
                  dp[i0][ia][ib][ic] *
                  ddic[sum0 - ic - w[i]][sum0 + sum1 - ia + ib - ic];
              dp[i0 + 1][ia + 1][ib][ic] %= mod;
              dp[i0 + 1][ia][ib + 1][ic] %= mod;
              dp[i0 + 1][ia][ib][ic + 1] %= mod;
            }
          }
        }
      }
      long long ans = 0;
      for (int ia = 0; ia <= m; ia++) {
        for (int ib = 0; ib + ia <= m; ib++) {
          for (int ic = 0; ia + ib + ic <= m; ic++) {
            ans += (w[i] - ia) * dp[m][ia][ib][ic];
            ans %= mod;
          }
        }
      }
      printf("%lld\n", ans);
    }
  }
  return 0;
}
