#include <bits/stdc++.h>
using namespace std;
vector<long long> a, b;
int cur = 0;
long long su = 0;
long long gpos = 0;
long long gneg = 0;
long long mod = 998244353;
long long fpow(long long a, long long b, long long md) {
  long long res = 1;
  a = (a % md);
  while (b > 0) {
    if (b % 2 == 1) {
      res = (res * a) % md;
    }
    b = b / 2;
    a = (a * a) % md;
  }
  return res % md;
}
map<pair<pair<int, int>, pair<int, int> >, long long> dp;
int n, m;
long long f(int i, int my, int pos, int neg) {
  if (i == m) {
    return (b[cur] + my * a[cur]) % mod;
  }
  if (dp.count(make_pair(make_pair(i, my), make_pair(pos, neg)))) {
    return dp[make_pair(make_pair(i, my), make_pair(pos, neg))];
  }
  long long denom = su + pos - neg;
  long long f1, f2, f3;
  f1 = f2 = f3 = 0;
  if (a[cur] == 1) {
    long long prob = b[cur] + my;
    if (prob > 0) {
      prob = (prob * fpow(denom, mod - 2, mod)) % mod;
      f1 = (prob * f(i + 1, my + 1, pos + 1, neg)) % mod;
    }
    long long probpos = gpos + pos - my - b[cur];
    if (probpos > 0) {
      probpos = (probpos * fpow(denom, mod - 2, mod)) % mod;
      f2 = (probpos * f(i + 1, my, pos + 1, neg)) % mod;
    }
    long long probneg = gneg - neg;
    if (probneg > 0) {
      probneg = (probneg * fpow(denom, mod - 2, mod)) % mod;
      f3 = (probneg * f(i + 1, my, pos, neg + 1)) % mod;
    }
    dp[make_pair(make_pair(i, my), make_pair(pos, neg))] = (f1 + f2 + f3) % mod;
    return (f1 + f2 + f3) % mod;
  } else {
    long long prob = b[cur] - my;
    if (prob > 0) {
      prob = (prob * fpow(denom, mod - 2, mod)) % mod;
      f1 = (prob * f(i + 1, my + 1, pos, neg + 1)) % mod;
    }
    long long probpos = gpos + pos;
    if (probpos > 0) {
      probpos = (probpos * fpow(denom, mod - 2, mod)) % mod;
      f2 = (probpos * f(i + 1, my, pos + 1, neg)) % mod;
    }
    long long probneg = gneg - neg - b[cur] + my;
    if (probneg > 0) {
      probneg = (probneg * fpow(denom, mod - 2, mod)) % mod;
      f3 = (probneg * f(i + 1, my, pos, neg + 1)) % mod;
    }
    dp[make_pair(make_pair(i, my), make_pair(pos, neg))] = (f1 + f2 + f3) % mod;
    return (f1 + f2 + f3) % mod;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n >> m;
  a.resize(n + 1);
  b.resize(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    if (a[i] == 0) {
      a[i] = -1;
      gneg += b[i];
    } else {
      gpos += b[i];
    }
    su += b[i];
  }
  for (int i = 0; i < n; i++) {
    dp.clear();
    cur = i;
    cout << f(0, 0, 0, 0) << '\n';
  }
}
