#include <bits/stdc++.h>
int const MOD = 998244353;
int invmod(int a) {
  int b = MOD;
  assert(0 <= a);
  assert(a < MOD);
  int ax = 1, bx = 0;
  while (b) {
    int q = a / b;
    a -= b * q;
    ax -= bx * q;
    std::swap(a, b);
    std::swap(ax, bx);
  }
  assert(a == 1);
  if (ax < 0) ax += MOD;
  assert(ax >= 0);
  return ax;
}
int main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  int npic, nvisit;
  std::cin >> npic >> nvisit;
  std::vector<char> like_pic(npic);
  for (char& l : like_pic) {
    std::cin >> l;
    l = char(l - '0');
  }
  std::vector<int> wt(npic);
  for (int& w : wt) std::cin >> w;
  int const sumallw = std::accumulate(begin(wt), end(wt), 0);
  for (int i = 0; i < npic; ++i) {
    int sumlk = 0, sumn = 0;
    for (int j = 0; j < npic; ++j)
      if (j != i) (like_pic[j] ? sumlk : sumn) += wt[j];
    std::vector<std::vector<int>> dp(nvisit + 1, std::vector<int>(nvisit + 1));
    std::vector<std::vector<int>> dpnext(nvisit + 1,
                                         std::vector<int>(nvisit + 1));
    dp[0][0] = wt[i];
    int out = 0;
    if (like_pic[i]) {
      for (int iter = 0; iter < nvisit; ++iter) {
        for (int b = 0; b <= nvisit; ++b)
          for (int c = 0; c <= nvisit; ++c)
            if (dp[b][c]) {
              int const a = iter - b - c;
              int64_t const invsum = invmod(sumallw + iter - 2 * b);
              assert(invsum > 0);
              int64_t const tmp = dp[b][c] * invsum % MOD;
              dpnext[b][c] = int((dpnext[b][c] + (sumlk + a) * tmp) % MOD);
              dpnext[b + 1][c] =
                  int((dpnext[b + 1][c] + (sumn - b) * tmp) % MOD);
              dpnext[b][c + 1] =
                  int((dpnext[b][c + 1] + (wt[i] + c + 1) * tmp) % MOD);
            }
        std::swap(dp, dpnext);
        for (auto& row : dpnext) row.assign(row.size(), 0);
      }
    } else {
      for (int iter = 0; iter < nvisit; ++iter) {
        for (int b = 0; b <= nvisit; ++b)
          for (int c = 0; c <= nvisit; ++c)
            if (dp[b][c]) {
              int const a = iter - b - c;
              int64_t const invsum = invmod(sumallw + 2 * a - iter);
              assert(invsum > 0);
              int64_t const tmp = dp[b][c] * invsum % MOD;
              dpnext[b][c] = int((dpnext[b][c] + (sumlk + a) * tmp) % MOD);
              dpnext[b + 1][c] =
                  int((dpnext[b + 1][c] + (sumn - b) * tmp) % MOD);
              dpnext[b][c + 1] =
                  int((dpnext[b][c + 1] + (wt[i] - c - 1) * tmp) % MOD);
            }
        std::swap(dp, dpnext);
        for (auto& row : dpnext) row.assign(row.size(), 0);
      }
    }
    for (int b = 0; b <= nvisit; ++b)
      for (int c = 0; c <= nvisit; ++c) {
        {
          int const wc = wt[i] + (like_pic[i] ? c : -c);
          if (dp[b][c]) assert(wc >= 0);
        }
        out = (out + dp[b][c]) % MOD;
      }
    std::cout << out << '\n';
  }
}
