#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
map<int, int> dp[2][55][55 * 55];
int m;
int bm(int b, int p, int m) {
  if (p == 0) return 1;
  int t = bm(b, p / 2, m);
  t = 1ll * t * t % m;
  if (p & 1) return 1ll * b * t % m;
  return t;
}
int solve(int step, int good, int bad, bool f) {
  if (step > m) return (f ? good : bad);
  if (dp[f][step][good].find(bad) != dp[f][step][good].end())
    return dp[f][step][good][bad];
  int ans = 1ll * solve(step + 1, good + 1, bad, f) * good % mod;
  if (bad) ans += 1ll * solve(step + 1, good, bad - 1, f) * bad % mod;
  ans %= mod;
  ans = 1ll * ans * bm(good + bad, mod - 2, mod) % mod;
  return dp[f][step][good][bad] = ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n >> m;
  vector<int> good(n);
  for (int i = 0; i < n; i++) cin >> good[i];
  vector<int> wt(n);
  int G = 0, B = 0;
  for (int i = 0; i < n; i++) {
    cin >> wt[i];
    if (good[i])
      G += wt[i];
    else
      B += wt[i];
  }
  int gans = solve(1, G, B, true);
  int bans = solve(1, G, B, false);
  for (int i = 0; i < n; i++) {
    int res;
    if (good[i]) {
      res = 1ll * gans * wt[i] % mod;
      res = 1ll * res * bm(G, mod - 2, mod) % mod;
    } else {
      res = 1ll * bans * wt[i] % mod;
      res = 1ll * res * bm(B, mod - 2, mod) % mod;
    }
    cout << res << " ";
  }
  return 0;
}
