#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int N = 55;
long long ans;
long long dp[N][N * 2][N];
long long rev[N * 2];
int n, m, tot, one, zero;
int l[N], w[N];
long long Pow(int x, int y) {
  long long ret = 1ll, mt = 1ll * x;
  while (y) {
    if (y & 1) ret = (ret * mt) % MOD;
    y >>= 1;
    mt = (mt * mt) % MOD;
  }
  return ret;
}
void print(int x, int y, int z) {
  printf("dp[%d][%d][%d]=%I64d\n", x, y, z, dp[x][y][z]);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", l + i);
    if (l[i] == 0) l[i]--;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", w + i);
    tot += w[i];
    if (l[i] == 1)
      one += w[i];
    else
      zero += w[i];
  }
  for (int i = -50; i <= 50; i++)
    if (tot + i >= 0) rev[N + i] = Pow(tot + i, MOD - 2);
  for (int x = 0; x < n; x++) {
    memset(dp, 0, sizeof(dp));
    dp[0][N][0] = 1ll;
    for (int i = 0; i < m; i++)
      for (int j = N - 50; j <= N + 50; j++)
        for (int k = 0; k <= 50; k++)
          if (dp[i][j][k]) {
            dp[i + 1][j + l[x]][k + 1] =
                (dp[i + 1][j + l[x]][k + 1] +
                 dp[i][j][k] * (w[x] + k * l[x]) % MOD * rev[j] % MOD) %
                MOD;
            int J = j - N, ONE = one, ZERO = zero;
            int inc = (J + i) / 2, dec = (J - i) / 2;
            if (l[x] == 1)
              ONE = (ONE - w[x] - k * l[x] + MOD) % MOD;
            else
              ZERO = (ZERO - w[x] - k * l[x] + MOD) % MOD;
            ONE += inc;
            ZERO += dec;
            dp[i + 1][j + 1][k] =
                (dp[i + 1][j + 1][k] + dp[i][j][k] * ONE % MOD * rev[j] % MOD) %
                MOD;
            dp[i + 1][j - 1][k] = (dp[i + 1][j - 1][k] +
                                   dp[i][j][k] * ZERO % MOD * rev[j] % MOD) %
                                  MOD;
          }
    ans = 0ll;
    for (int j = N - 50; j <= N + 50; j++)
      for (int k = 0; k <= 50; k++) {
        ans = (ans + dp[m][j][k] * (w[x] + k * l[x] % MOD + MOD) % MOD) % MOD;
      }
    printf("%I64d\n", ans);
  }
  return 0;
}
