#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 105;
const long long int modd = 998244353;
long long int dp[maxn][maxn][maxn], n, m, i;
long long int a[maxn], w[maxn];
void count(long long int a, long long int b, long long int &x,
           long long int &y) {
  if (a == 1 && b == 0) {
    x = 1;
    y = 1;
    return;
  } else {
    count(b, a % b, y, x);
    y = (y - (a / b) * x % modd) % modd;
    return;
  }
}
long long int qny(long long int a) {
  long long int x, y;
  count(modd, a, x, y);
  y = (y + modd) % modd;
  return y;
}
void do_it(long long int x) {
  long long int i, j, k, p, ta = 0, tb = 0, tm = 0, tt;
  if (a[x] == 0)
    tt = -1;
  else
    tt = 1;
  for (i = 1; i <= n; i++) {
    if (i == x)
      tm += w[i];
    else {
      if (a[i] == 1) ta += w[i];
      if (a[i] == 0) tb += w[i];
    }
  }
  dp[0][0][0] = 1;
  for (k = 0; k <= m; k++) {
    for (i = 0; i <= k; i++) {
      for (j = 0; j <= k - i; j++) {
        if (dp[k][i][j] == 0) continue;
        p = k - i - j;
        dp[k + 1][i + 1][j] = (dp[k + 1][i + 1][j] +
                               dp[k][i][j] * (ta + i) % modd *
                                   qny(ta + i + tb - j + tm + tt * p) % modd) %
                              modd;
        dp[k + 1][i][j + 1] = (dp[k + 1][i][j + 1] +
                               dp[k][i][j] * (tb - j) % modd *
                                   qny(ta + i + tb - j + tm + tt * p) % modd) %
                              modd;
        dp[k + 1][i][j] =
            (dp[k + 1][i][j] + dp[k][i][j] * (tm + tt * p) % modd *
                                   qny(ta + i + tb - j + tm + tt * p) % modd) %
            modd;
      }
    }
  }
  long long int ans = 0;
  for (i = 0; i <= m; i++) {
    for (j = 0; j <= m; j++) {
      if (dp[m][i][j] == 0) continue;
      p = m - i - j;
      ans = (ans + (dp[m][i][j] * ((w[x] + p * tt) % modd)) % modd) % modd;
    }
  }
  ans = (ans + modd) % modd;
  printf("%lld\n", ans);
  return;
}
int main() {
  scanf("%lld%lld", &n, &m);
  long long int i;
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (i = 1; i <= n; i++) scanf("%lld", &w[i]);
  for (i = 1; i <= n; i++) {
    memset(dp, 0, sizeof(dp));
    do_it(i);
  }
  return 0;
}
