#include <bits/stdc++.h>
using namespace std;
const int64_t MAX = 55, MOD = 998244353;
int64_t n, m, sumW = 0, sumL = 0, C[MAX], W[MAX], F[MAX][MAX][2 * MAX][2];
bool Free[MAX][MAX][2 * MAX][2];
int64_t Mul(int64_t x, int64_t k) {
  if (k == 0) return 1;
  int64_t tmp = Mul(x, k / 2);
  if (k % 2 == 0) return tmp * tmp % MOD;
  return tmp * tmp % MOD * x % MOD;
}
int64_t DP(int64_t step, int64_t like, int64_t curW, int64_t type) {
  if (step == m) return curW;
  if (Free[step][like][curW][type] == true) return F[step][like][curW][type];
  Free[step][like][curW][type] = true;
  int64_t cursumW = sumW + like - (step - like);
  int64_t cursumL = sumL + like;
  int64_t rs = 0;
  int64_t invcursumW = Mul(cursumW, MOD - 2);
  if (cursumL - curW * type > 0)
    rs = (rs + (cursumL - curW * type) * DP(step + 1, like + 1, curW, type) %
                   MOD * invcursumW) %
         MOD;
  if (cursumW - cursumL - curW * (1 - type) > 0)
    rs = (rs + (cursumW - cursumL - curW * (1 - type)) *
                   DP(step + 1, like, curW, type) % MOD * invcursumW) %
         MOD;
  if (curW > 0)
    rs = (rs +
          curW * DP(step + 1, like + type, curW + (type == 1 ? 1 : -1), type) %
              MOD * invcursumW) %
         MOD;
  return F[step][like][curW][type] = rs;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int64_t i = 1; i <= n; i++) cin >> C[i];
  for (int64_t i = 1; i <= n; i++) {
    cin >> W[i];
    sumW += W[i];
    sumL += W[i] * C[i];
  }
  for (int64_t i = 1; i <= n; i++) cout << DP(0, 0, W[i], C[i]) << "\n";
}
