#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;
}
int dp[60][60][60];
int a[60], w[60];
void add(int &x, int y) {
  if (y < 0) y += mod;
  x += y;
  if (x >= mod) x -= mod;
}
int main() {
  int n, m;
  cin >> n >> m;
  int tot0 = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int j = 1; j <= n; j++) {
    cin >> w[j];
    if (a[j] == 0) tot0 += w[j];
  }
  int tot = 0;
  for (int j = 1; j <= n; j++) tot += w[j];
  for (int i = 1; i <= n; i++) {
    memset(dp, 0, sizeof dp);
    dp[0][0][0] = 1;
    for (int j = 0; j < m; j++) {
      for (int k = 0; k <= j; k++) {
        for (int l = 0; l <= j; l++) {
          int sum = tot + j - 2 * k;
          int pb = power(sum, mod - 2, mod);
          int sum0 = tot0 - k;
          int sum1 = sum - sum0;
          if (a[i] == 0) sum0 -= (w[i] - l);
          if (a[i] == 1) sum1 -= (w[i] + l);
          add(dp[j + 1][k + 1][l], (INT)pb * sum0 % mod * dp[j][k][l] % mod);
          add(dp[j + 1][k][l], (INT)pb * sum1 % mod * dp[j][k][l] % mod);
          int x = w[i];
          if (a[i] == 1) {
            x += l;
            add(dp[j + 1][k][l + 1], (INT)pb * x % mod * dp[j][k][l] % mod);
          } else {
            x -= l;
            add(dp[j + 1][k + 1][l + 1], (INT)pb * x % mod * dp[j][k][l] % mod);
          }
        }
      }
    }
    int E = 0;
    for (int k = 0; k <= m; k++)
      for (int j = 0; j <= m; j++) {
        int W = w[i];
        if (a[i] == 1)
          W += j;
        else
          W -= j;
        add(E, (INT)dp[m][k][j] * W % mod);
      }
    printf("%d\n", E);
  }
  cout << endl;
  return 0;
}
