#include <bits/stdc++.h>
using namespace std;
using INT = long long;
const int mod = 998244353;
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
const int N = 50;
int a[110], w[110], dp[110][110][110], tmp[110][110][110];
void add(int &x, int y) {
  y = (y + mod) % mod;
  x += y;
  if (x >= mod) x -= mod;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int sum = 0, ss = 0;
  for (int j = 1; j <= n; j++) {
    cin >> w[j];
    sum += w[j];
    if (a[j] == 0) ss += w[j];
  }
  for (int i = 1; i <= n; i++) {
    dp[i][0][0] = 1;
  }
  for (int k = 1; k <= m; k++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j <= k - 1; j++) {
        for (int l = 0; l <= k - 1; l++) {
          int op = (a[i] == 0);
          int f = a[i];
          if (f == 0) f = -1;
          int tot = sum + k - 1 - 2 * l;
          int pb = (INT)power(tot, mod - 2, mod) * (w[i] + f * j) % mod;
          int t = ss - l;
          if (a[i] == 0) t -= (w[i] - j);
          int qb = (INT)power(tot, mod - 2, mod) * t % mod;
          qb = (qb + mod) % mod;
          pb = (pb + mod) % mod;
          add(tmp[i][j + 1][l + op], (INT)pb * dp[i][j][l] % mod);
          add(tmp[i][j][l + 1], (INT)qb * dp[i][j][l] % mod);
          add(tmp[i][j][l], (INT)dp[i][j][l] * (1 - pb - qb) % mod);
        }
      }
    }
    for (int i = 1; i <= n; i++)
      for (int j = 0; j <= k; j++)
        for (int l = 0; l <= k; l++) {
          dp[i][j][l] = tmp[i][j][l];
          tmp[i][j][l] = 0;
        }
  }
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    int f = a[i];
    if (f == 0) f = -1;
    for (int j = 0; j <= m; j++) {
      for (int l = 0; l <= m; l++) {
        add(ans, (INT)(w[i] + f * j) * dp[i][j][l] % mod);
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
