#include <bits/stdc++.h>
using namespace std;
const int Mod = 998244353;
int n, m, a[55], w[55], f[55][105][55], g[55][105][55], x, sa, sb;
int power(int b, int e) {
  if (!e) return 1;
  int tmp = power(b, e >> 1);
  tmp = 1ll * tmp * tmp % Mod;
  if (e & 1) tmp = 1ll * tmp * b % Mod;
  return tmp;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= n; i++)
    if (!a[i])
      sa += w[i];
    else
      sb += w[i];
  for (int j = 0; j <= 100; j++)
    for (int k = 0; k <= m; k++) f[0][j][k] = j;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= 100; j++)
      for (int k = 0; k <= m; k++)
        if (sb + k >= j && sa >= m - i - k) {
          f[i][j][k] = (1ll * j * f[i - 1][j + 1][k + 1] +
                        1ll * (sb + k - j) * f[i - 1][j][k + 1] +
                        1ll * (sa - m + i + k) * f[i - 1][j][k]) %
                       Mod;
          f[i][j][k] =
              1ll * f[i][j][k] * power(sa + sb + k - m + i + k, Mod - 2) % Mod;
        }
  for (int j = 0; j <= 100; j++)
    for (int k = 0; k <= m; k++) g[0][j][k] = j;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= 100; j++)
      for (int k = 0; k <= m; k++) {
        g[i][j][k] = (1ll * j * g[i - 1][j - 1][k] +
                      1ll * (sb + k) * g[i - 1][j][k + 1] +
                      1ll * (sa - j - m + i + k) * g[i - 1][j][k]) %
                     Mod;
        g[i][j][k] =
            1ll * g[i][j][k] * power(sa + sb + k - m + i + k, Mod - 2) % Mod;
      }
  for (int i = 1; i <= n; i++)
    if (a[i])
      cout << f[m][w[i]][0] << '\n';
    else
      cout << g[m][w[i]][0] << '\n';
  return 0;
}
