#include <bits/stdc++.h>
using namespace std;
const int N = 110;
const int Mod = 998244353;
long long Min(long long x, long long y) { return x < y ? x : y; }
long long Max(long long x, long long y) { return x > y ? x : y; }
long long R() {
  long long ans = 0, f = 1;
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) ans = ans * 10 + c - '0';
  return ans * f;
}
int n, m;
long long a[N], w[N];
long long Pow(long long x, long long bs) {
  long long an = 1;
  for (; bs; bs >>= 1, x = x * x % Mod)
    if (bs & 1) an = an * x % Mod;
  return an;
}
long long dp[60][60][60];
long long s0, s1, sum;
void Ad(long long &x, long long y) { x = (x + y) % Mod; }
int main() {
  n = R();
  m = R();
  for (int i = 1; i <= n; ++i) a[i] = R();
  for (int i = 1; i <= n; ++i) w[i] = R();
  for (int i = 1; i <= n; ++i) s0 += w[i] * (a[i] == 0);
  for (int i = 1; i <= n; ++i) s1 += w[i] * (a[i] == 1);
  for (int i = 1; i <= n; ++i)
    if (a[i] == 0) a[i] = -1;
  sum = s0 + s1;
  for (int u = 1; u <= n; ++u) {
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    for (int i = 0; i <= m - 1; ++i)
      for (int j = 0; j <= i; ++j)
        for (int k = 0; k <= i; ++k) {
          long long ni = Pow(sum + j + j - i, Mod - 2);
          long long uu = (w[u] + a[u] * k);
          Ad(dp[i + 1][j + (a[u] == 1)][k + 1], dp[i][j][k] * ni % Mod * uu);
          Ad(dp[i + 1][j + 1][k],
             dp[i][j][k] * ni % Mod * (s1 + j - uu * (a[u] == 1)));
          Ad(dp[i + 1][j][k],
             dp[i][j][k] * ni % Mod * (s0 - i + j - uu * (a[u] == -1)));
        }
    long long ans = 0;
    for (int i = 0; i <= m; ++i)
      for (int j = 0; j <= m; ++j) Ad(ans, (j * a[u] + w[u]) * dp[m][i][j]);
    cout << ans << '\n';
  }
  return 0;
}
