#include <bits/stdc++.h>
using namespace std;
template <typename Q>
inline char inin(Q &x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x = f ? -x : x;
  return ch;
}
const long long mod = 998244353;
long long qpow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return ret;
}
long long inv(long long a) { return qpow(a, mod - 2); }
int n, m;
int a[55], w[55], ww, fw;
long long js(int x, int y, int z) {
  long long f[55][55][55];
  memset(f, 0, sizeof(f));
  f[0][0][0] = 1;
  int mm = m;
  if (y == -1) mm = min(mm, x);
  for (int i = (0); i <= (mm); i++)
    for (int j = (0); j <= ((ww - fw == x && y == 1) ? 0 : m - i); j++)
      for (int k = (0); k <= (min(z, m - i - j)); k++) {
        if (i + j + k == 0) continue;
        f[i][j][k] = 0;
        if (i)
          (f[i][j][k] += f[i - 1][j][k] * (x + y * (i - 1)) % mod *
                         inv(ww + y * (i - 1) + j - k) % mod) %= mod;
        if (j)
          (f[i][j][k] += f[i][j - 1][k] * (ww - (y == 1 ? x : 0) - fw + j - 1) %
                         mod * inv(ww + y * (i) + j - 1 - k) % mod) %= mod;
        if (k)
          (f[i][j][k] += f[i][j][k - 1] * (fw - (y == -1 ? x : 0) - (k - 1)) %
                         mod * inv(ww + y * i + j - (k - 1)) % mod) %= mod;
      }
  long long ret = 0;
  for (int i = (0); i <= (m); i++) {
    for (int j = (0); j <= (m - i); j++)
      (ret += 1LL * (x + y * i) * f[i][j][m - i - j] % mod) %= mod;
  }
  return ret;
}
int main() {
  inin(n), inin(m);
  for (int i = (1); i <= (n); i++) inin(a[i]);
  for (int i = (1); i <= (n); i++) inin(w[i]), ww += w[i];
  for (int i = (1); i <= (n); i++)
    if (!a[i]) fw += w[i];
  for (int i = (1); i <= (n); i++)
    printf("%lld\n", js(w[i], a[i] ? 1 : -1, fw - (a[i] ? 0 : w[i])) % mod);
  return 0;
}
