#include <bits/stdc++.h>
using namespace std;
const int N = 50 + 5, M = 50 + 5, P = 998244353;
int n, m, s1, s2, w[N], p[M][M] = {1};
bool a[N];
inline int power(int a, int b) {
  int ans = 1;
  for (; b; a = 1LL * a * a % P, b >>= 1) ans = b & 1 ? 1LL * ans * a % P : ans;
  return ans;
}
inline void read_input() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    (a[i] ? s1 : s2) += w[i];
  }
}
inline void solve() {
  for (int i = 0; i <= m; i++)
    for (int j = 0; j <= s2 && i + j <= m; j++) {
      (p[i][j] += i ? 1LL * p[i - 1][j] * (s1 + i - 1LL) % P *
                          power(s1 + s2 + i - j - 1, P - 2) % P
                    : 0) %= P;
      (p[i][j] += j ? 1LL * p[i][j - 1] * (s2 - j + 1LL) % P *
                          power(s1 + s2 + i - j + 1, P - 2) % P
                    : 0) %= P;
    }
}
inline void write_output() {
  int p1 = 0, p2 = 0;
  for (int i = 0; i <= m; i++) {
    (p1 += 1LL * i * p[i][m - i] % P) %= P;
    (p2 += P - 1LL * (m - i) * p[i][m - i] % P) %= P;
  }
  p1 = 1LL * p1 * power(s1, P - 2) % P;
  p2 = 1LL * p2 * power(s2, P - 2) % P;
  for (int i = 0; i < n; i++)
    cout << (w[i] + 1LL * w[i] * (a[i] ? p1 : p2)) % P << endl;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  read_input(), solve(), write_output();
  return 0;
}
