#include <bits/stdc++.h>
using namespace std;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
void setupIO(const string &PROB = "") {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  if (PROB.length() != 0) {
    ifstream infile(PROB + ".in");
    if (infile.good()) {
      freopen((PROB + ".in").c_str(), "r", stdin);
      freopen((PROB + ".out").c_str(), "w", stdout);
    }
  }
}
long long dp[101][52][52];
long long dp2[101][52][52];
int mod = 998244353;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long power(long long base, long long pwr, long long mod) {
  long long res = 1;
  base = base % mod;
  while (pwr > 0) {
    if (pwr & 1) res = (res * base) % mod;
    pwr = pwr >> 1;
    base = (base * base) % mod;
  }
  return res;
}
long long modInverse(long long x, long long m) {
  long long g = gcd(x, m);
  if (g != 1) {
    return -1;
  } else {
    return power(x, m - 2, m);
  }
}
int main() {
  setupIO();
  int n, m;
  cin >> n >> m;
  int like[n];
  for (int i = 0; i < (n); i++) cin >> like[i];
  int init_weight[n];
  for (int i = 0; i < (n); i++) cin >> init_weight[i];
  int weight_like = 0, weight_nolike = 0;
  for (int i = 0; i < (n); i++) {
    if (like[i])
      weight_like += init_weight[i];
    else
      weight_nolike += init_weight[i];
  }
  for (int k = (51) - 1; k >= 0; k--) {
    for (int w = 0; w < (101); w++) {
      for (int i = 0; i < (k + 1); i++) {
        int j = k - i;
        if (k == m) {
          dp[w][i][j] = w;
          dp2[w][i][j] = w;
          continue;
        }
        if (w == 100) continue;
        int totWeight = weight_like + weight_nolike + i - j;
        dp[w][i][j] =
            (w * dp[w + 1][i + 1][j]) % mod * modInverse(totWeight, mod) % mod;
        dp[w][i][j] += ((weight_like + i - w) * dp[w][i + 1][j]) % mod *
                       modInverse(totWeight, mod) % mod;
        dp[w][i][j] += ((weight_nolike - j) * dp[w][i][j + 1]) % mod *
                       modInverse(totWeight, mod) % mod;
        dp[w][i][j] %= mod;
        if (isnan(dp[w][i][j])) {
          dp[w][i][j] = 0;
        }
        dp2[w][i][j] =
            (w * dp2[w - 1][i][j + 1]) % mod * modInverse(totWeight, mod) % mod;
        dp2[w][i][j] += ((weight_like + i) * dp2[w][i + 1][j]) % mod *
                        modInverse(totWeight, mod) % mod;
        dp2[w][i][j] += ((weight_nolike - j - w) * dp2[w][i][j + 1]) % mod *
                        modInverse(totWeight, mod) % mod;
        dp2[w][i][j] %= mod;
        if (isnan(dp2[w][i][j])) {
          dp2[w][i][j] = 0;
        }
      }
    }
  }
  for (int i = 0; i < (n); i++) {
    if (like[i]) {
      cout << dp[init_weight[i]][0][0] << endl;
    } else {
      cout << dp2[init_weight[i]][0][0] << endl;
    }
  }
  return 0;
}
