#include <bits/stdc++.h>
using namespace std;
const int P = 998244353;
int add(int a, int b) {
  if ((a += b) >= P) a -= P;
  return a < 0 ? a + P : a;
}
int mul(int a, int b) { return 1ll * a * b % P; }
int kpow(int a, int b) {
  int r = 1;
  for (; b; b >>= 1, a = mul(a, a)) {
    if (b & 1) r = mul(r, a);
  }
  return r;
}
const int N = 200;
int n, m, a[N], f[N][N], s1, s2, s, w[N], tmp[N], ans[N], in[5000];
int inv(int x) {
  if (!in[x])
    return in[x] = kpow(x, P - 2);
  else
    return in[x];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = (1); i < (n + 1); i++) {
    cin >> a[i];
  }
  for (int i = (1); i < (n + 1); i++) {
    cin >> w[i], s += w[i];
    if (a[i])
      s2 += w[i];
    else
      s1 += w[i];
  }
  f[0][0] = 1;
  for (int i = (1); i < (m + 1); i++) {
    for (int j = (0); j < (m + 1); j++) {
      int &t = f[i][j + 1], sum = s + j - (i - 1 - j);
      if (i - 1 - j > s1) continue;
      t = add(t, mul(f[i - 1][j], mul(j + s2, inv(sum))));
      int &t2 = f[i][j];
      t2 = add(t2, mul(f[i - 1][j], mul(sum - j - s2, inv(sum))));
    }
  }
  for (int j = (0); j < (m + 1); j++) {
    for (int l = (1); l < (n + 1); l++)
      if (a[l]) {
        memset(tmp, 0, sizeof(tmp));
        tmp[0] = 1;
        for (int k = (1); k < (j + 1); k++) {
          for (int o = (k + 1) - 1; o >= (0); o--) {
            int z = 0;
            z = add(z,
                    mul(tmp[o], mul(s2 + k - 1 - (w[l] + o), inv(s2 + k - 1))));
            if (o)
              z = add(z, mul(tmp[o - 1], mul(w[l] + o - 1, inv(s2 + k - 1))));
            tmp[o] = z;
          }
        }
        for (int k = (0); k < (j + 1); k++)
          ans[l] = add(ans[l], mul(tmp[k], mul(w[l] + k, f[m][j])));
      } else {
        memset(tmp, 0, sizeof(tmp));
        tmp[w[l]] = 1;
        if (m - j > s1) continue;
        for (int k = (1); k < (m - j + 1); k++) {
          for (int o = (0); o < (w[l] + 1); o++) {
            int z = 0;
            if (s1 - (k - 1) - o < 0) continue;
            z = add(z, mul(tmp[o], mul(s1 - (k - 1) - o, inv(s1 - (k - 1)))));
            z = add(z, mul(tmp[o + 1], mul(o + 1, inv(s1 - (k - 1)))));
            tmp[o] = z;
          }
        }
        for (int k = (0); k < (w[l] + 1); k++)
          ans[l] = add(ans[l], mul(tmp[k], mul(k, f[m][j])));
      }
  }
  for (int i = (1); i < (n + 1); i++) cout << ans[i] << "\n";
  return 0;
}
