#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000;
const int mod = 998244353;
long long a[maxn], w[maxn], inv[maxn], dp[100][100][100], A, B, m, n;
void add(long long& x, long long y) { x = (x + y) % mod; }
long long mul(long long x, long long y) { return (x * y) % mod; }
void mul2(long long& x, long long y) { x = (x * y) % mod; }
void solve(long long x) {
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;
  for (long long i = 0; i <= m; i++) {
    for (long long j = 0; j <= i; j++) {
      for (long long k = 0; k <= j; k++) {
        if (a[x]) {
          long long wx = w[x] + k, wa = A + j, wb = B - (i - j);
          add(dp[i + 1][j + 1][k + 1], mul(mul(dp[i][j][k], wx), inv[wa + wb]));
          add(dp[i + 1][j + 1][k],
              mul(mul(dp[i][j][k], wa - wx), inv[wa + wb]));
          add(dp[i + 1][j][k], mul(mul(dp[i][j][k], wb), inv[wa + wb]));
        } else {
          long long wx = w[x] - k, wb = B - j, wa = A + (i - j);
          add(dp[i + 1][j + 1][k + 1], mul(mul(dp[i][j][k], wx), inv[wa + wb]));
          add(dp[i + 1][j + 1][k],
              mul(mul(dp[i][j][k], (wb - wx)), inv[wa + wb]));
          add(dp[i + 1][j][k], mul(mul(dp[i][j][k], wa), inv[wa + wb]));
        }
      }
    }
  }
  long long re = 0;
  for (long long i = 0; i <= m; i++) {
    for (long long j = 0; j <= i; j++) {
      if (a[x]) {
        long long val = w[x] + j;
        add(re, mul(val, dp[m][i][j]));
      } else {
        long long val = w[x] - j;
        add(re, mul(val, dp[m][i][j]));
      }
    }
  }
  printf("%I64d\n", re);
}
long long mypow(long long x, long long y) {
  long long re = 1;
  while (y) {
    if (y & 1LL) mul2(re, x);
    y >>= 1;
    mul2(x, x);
  }
  return re;
}
void prework() {
  for (long long i = 1; i <= 3000; i++) {
    inv[i] = mypow(i, mod - 2);
  }
}
int main() {
  prework();
  scanf("%I64d%I64d", &n, &m);
  A = B = 0;
  for (long long i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (long long i = 1; i <= n; i++) {
    scanf("%I64d", &w[i]);
    if (a[i])
      A += w[i];
    else
      B += w[i];
  }
  for (long long i = 1; i <= n; i++) solve(i);
  return 0;
}
