#include <bits/stdc++.h>
using namespace std;
const long long N = 55, M = 998244353;
long long inv[N * N * N], n, f[2][N][N][N][N], m, flag[N], a[N];
long long ksm(long long x, long long y) {
  if (!y) return 1;
  long long z = ksm(x, y / 2);
  z *= z;
  z %= M;
  if (y & 1) z *= x;
  return z % M;
}
signed main() {
  scanf("%lld%lld", &n, &m);
  long long sum = 0, sum1 = 0, sum2 = 0;
  for (long long i = 1; i <= n; i++) scanf("%lld", &flag[i]);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]), sum += a[i];
  for (long long i = 1; i <= n; i++)
    if (flag[i] == 1)
      sum1 += a[i];
    else
      sum2 += a[i];
  inv[0] = 1;
  for (long long i = 1; i < N * N * N; i++) inv[i] = ksm(i, M - 2);
  for (long long i = 1; i <= n; i++) f[0][i][0][0][0] = 1;
  for (long long T = 0; T < m; T++) {
    long long t = T & 1, p = t ^ 1;
    for (long long i = 1; i <= n; i++)
      for (long long j = 0; j <= T; j++)
        for (long long k = 0; k <= T; k++)
          for (long long l = 0; l <= T; l++)
            if (flag[i] == 1) {
              f[p][i][j + 1][k + 1][l] +=
                  f[t][i][j][k][l] * inv[sum + k - l] % M * (a[i] + j);
              f[p][i][j][k + 1][l] += f[t][i][j][k][l] * inv[sum + k - l] % M *
                                      (sum1 + k - a[i] - j);
              f[p][i][j][k][l + 1] +=
                  f[t][i][j][k][l] * inv[sum + k - l] % M * (sum2 - l);
            } else {
              f[p][i][j + 1][k][l + 1] +=
                  f[t][i][j][k][l] * inv[sum + k - l] % M * (a[i] - j);
              f[p][i][j][k][l + 1] += f[t][i][j][k][l] * inv[sum + k - l] % M *
                                      (sum2 - l - (a[i] - j));
              f[p][i][j][k + 1][l] +=
                  f[t][i][j][k][l] * inv[sum + k - l] % M * (sum1 + k);
            }
    for (long long i = 1; i <= n; i++)
      for (long long j = 0; j <= T + 1; j++)
        for (long long k = 0; k <= T + 1; k++)
          for (long long l = 0; l <= T + 1; l++)
            f[t][i][j][k][l] = 0, f[p][i][j][k][l] %= M;
  }
  long long t = m & 1;
  for (long long i = 1; i <= n; i++) {
    long long sum = 0;
    for (long long j = 0; j <= m; j++)
      for (long long k = 0; k <= m; k++)
        for (long long l = 0; l <= m; l++) (sum += f[t][i][j][k][l] * j) %= M;
    if (flag[i] == 0) sum = (M - sum) % M;
    printf("%lld\n", (a[i] + sum + M) % M);
  }
  return 0;
}
