#include <bits/stdc++.h>
using namespace std;
struct P {
  int x, y, z;
};
vector<int> v;
int i, n, m, k, a, d, b, c;
int e;
int o[52];
int l[51];
long long j[55][155][55][2];
int dx[10] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[10] = {1, 0, -1, 0, 1, -1, 1, -1},
    dz[10] = {0, 0, 0, 0, 1, -1};
int px[10] = {-1, 1, 1, -1, 1, 1, -1, -1},
    py[10] = {1, 1, -1, -1, 1, -1, 1, -1};
long long mod = 998244353, mod2 = 1000000009, mod3 = 2017;
long long x, z, y;
double pi = 3.14159265;
P u[1];
stack<long long> s;
queue<P> q;
char r[2211];
map<int, int> p;
long long g(long long x, long long y) {
  long long p = 1;
  for (; y; x *= x, x %= mod, y /= 2)
    if (y % 2) p *= x, p %= mod;
  return p;
}
long long f(int n, int m, int k, int i) {
  if (m == 0 || n - k > d) return 0;
  if (n == b) return m;
  if (j[n][m][k][i] >= 0) return j[n][m][k][i];
  if (i % 2) {
    j[n][m][k][i] = f(n + 1, m + 1, k + 1, i) * m % mod *
                    g(c + d + 2 * k - n, mod - 2) % mod;
    j[n][m][k][i] += f(n + 1, m, k + 1, i) * (c + k - m) % mod *
                     g(c + d + 2 * k - n, mod - 2) % mod;
    j[n][m][k][i] += f(n + 1, m, k, i) * (d - (n - k)) % mod *
                     g(c + d + 2 * k - n, mod - 2) % mod;
    j[n][m][k][i] %= mod;
    return j[n][m][k][i];
  }
  if (n - k + m > d) return 0;
  j[n][m][k][i] =
      f(n + 1, m - 1, k, i) * m % mod * g(c + d + 2 * k - n, mod - 2) % mod;
  j[n][m][k][i] += f(n + 1, m, k + 1, i) * (c + k) % mod *
                   g(c + d + 2 * k - n, mod - 2) % mod;
  j[n][m][k][i] += f(n + 1, m, k, i) * (d - (n - k) - m) % mod *
                   g(c + d + 2 * k - n, mod - 2) % mod;
  j[n][m][k][i] %= mod;
  return j[n][m][k][i];
}
int main() {
  memset(j, -1, sizeof(j));
  scanf("%d %d", &a, &b);
  for (int t = 1; t <= a; t++) scanf("%d", &o[t]);
  for (int t = 1; t <= a; t++) {
    scanf("%d", &l[t]);
    if (o[t] % 2)
      c += l[t];
    else
      d += l[t];
  }
  for (int t = 1; t <= a; t++) {
    printf("%lld\n", f(0, l[t], 0, o[t]));
  }
}
