#include <bits/stdc++.h>
using namespace std;
int n, m, a[55], w[55];
long long f[55][55][55];
const int mod = 998244353;
int ksm(int x, int k) {
  int ret = 1, tmp = x;
  while (k) {
    if (k & 1) ret = 1ll * ret * tmp % mod;
    tmp = 1ll * tmp * tmp % mod;
    k >>= 1;
  }
  return ret;
}
int inv(int x) { return ksm(x, mod - 2); }
int main() {
  int sum = 0, sum0 = 0, sum1 = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++)
    cin >> w[i], sum += w[i], sum1 += a[i] == 1 ? w[i] : 0,
        sum0 += a[i] == 0 ? w[i] : 0;
  for (int i = 1; i <= n; i++) {
    memset(f, 0, sizeof(f));
    f[0][0][0] = 1;
    for (int j = 0; j < m; j++) {
      for (int k = 0; k <= j; k++) {
        int cursum = sum + k - (j - k);
        for (int l = 0; l <= j; l++) {
          if (!f[j][k][l]) continue;
          int curw = w[i] + (a[i] ? l : -l),
              curp = 1ll * curw * inv(cursum) % mod;
          if (a[i]) {
            int cur0 = 1ll * (sum0 - (j - k)) * inv(cursum) % mod;
            int cur1 = 1ll * (sum1 + k - curw) * inv(cursum) % mod;
            (f[j + 1][k + 1][l + 1] += 1ll * curp * f[j][k][l]) %= mod;
            (f[j + 1][k + 1][l] += 1ll * cur1 * f[j][k][l]) %= mod;
            (f[j + 1][k][l] += 1ll * cur0 * f[j][k][l]) %= mod;
          } else {
            int cur0 = 1ll * (sum0 - (j - k) - curw) * inv(cursum) % mod;
            int cur1 = 1ll * (sum1 + k) * inv(cursum) % mod;
            (f[j + 1][k][l + 1] += 1ll * curp * f[j][k][l]) %= mod;
            (f[j + 1][k + 1][l] += 1ll * cur1 * f[j][k][l]) %= mod;
            (f[j + 1][k][l] += 1ll * cur0 * f[j][k][l]) %= mod;
          }
        }
      }
    }
    int ans = 0;
    for (int k = 0; k <= m; k++)
      for (int l = 0; l <= m; l++)
        ans = (ans + 1ll * f[m][k][l] * (w[i] + (a[i] ? l : -l))) % mod;
    cout << (ans + mod) % mod << "\n";
  }
  return 0;
}
