#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
long long n, m;
bool like[102];
long long weight[102];
long long DP[102][102][102];
long long ans[102];
long long likeSum, dislikeSum;
long long myPow(long long x, long long y) {
  if (y == 0) return 1;
  if (y & 1) return (myPow(x, y - 1) * x) % MOD;
  long long tmp = myPow(x, y >> 1);
  return (tmp * tmp) % MOD;
}
long long modularInverse(long long x) { return myPow(x, MOD - 2); }
long long inv[5002];
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; }
int main() {
  scanf("%lld %lld", &n, &m);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &like[i]);
  }
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &weight[i]);
    if (like[i])
      likeSum += weight[i];
    else
      dislikeSum += weight[i];
  }
  inv[0] = 1;
  for (long long i = 1; i <= 5000; i++) {
    inv[i] = modularInverse(i);
  }
  for (long long i = 1; i <= n; i++) {
    memset(DP, 0, sizeof(DP));
    if (like[i])
      likeSum -= weight[i];
    else
      dislikeSum -= weight[i];
    DP[0][0][0] = 1;
    for (long long j = 0; j < m; j++) {
      for (long long k = 0; k <= j; k++) {
        for (long long l = 0; l <= j - k; l++) {
          if (DP[j][k][l]) {
            long long cur = DP[j][k][l];
            long long c1 = weight[i] + (like[i] ? j - k - l : -j + k + l);
            long long c2 = k + likeSum;
            long long c3 = dislikeSum - l;
            long long cAll = c1 + c2 + c3;
            long long invAll = inv[cAll];
            if (c1 > 0) {
              add(DP[j + 1][k][l], mul(cur, mul(c1, invAll)));
            }
            if (c2 > 0) {
              add(DP[j + 1][k + 1][l], mul(cur, mul(c2, invAll)));
            }
            if (c3 > 0) {
              add(DP[j + 1][k][l + 1], mul(cur, mul(c3, invAll)));
            }
          }
        }
      }
    }
    long long tmp = 0;
    for (long long j = 0; j <= m; j++) {
      for (long long k = 0; k <= m - j; k++) {
        if (DP[m][j][k]) {
          add(tmp,
              mul(weight[i] + (like[i] ? m - j - k : -m + j + k), DP[m][j][k]));
        }
      }
    }
    printf("%lld\n", tmp);
    if (like[i])
      likeSum += weight[i];
    else
      dislikeSum += weight[i];
  }
}
