#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const long long MOD = 998244353;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = 1e-8;
int _;
using namespace std;
long long powermod(long long n, long long k, long long MOD) {
  long long ans = 1;
  while (k) {
    if (k & 1) {
      ans = ((ans % MOD) * (n % MOD)) % MOD;
    }
    n = ((n % MOD) * (n % MOD)) % MOD;
    k >>= 1;
  }
  return ans;
}
int aa[105];
long long gg[105];
long long dp_sa[3005][3005];
long long dp_sb[3005][3005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int N, M;
  while (cin >> N >> M) {
    long long sa = 0;
    long long sb = 0;
    for (int i = 1; i <= N; ++i) cin >> aa[i];
    for (int i = 1; i <= N; ++i) {
      cin >> gg[i];
      if (aa[i])
        sa += gg[i];
      else
        sb += gg[i];
    }
    memset(dp_sa, 0, sizeof(dp_sa));
    memset(dp_sb, 0, sizeof(dp_sb));
    for (int i = M; i >= 0; --i) {
      dp_sa[i][M - i] = dp_sb[i][M - i] = 1;
      for (int j = min(1LL * M - i - 1, sb); j >= 0; --j) {
        dp_sa[i][j] = ((sa + i + 1) % MOD * dp_sa[i + 1][j] % MOD *
                           powermod(sa + sb + i - j, MOD - 2, MOD) % MOD +
                       (sb - j) % MOD * dp_sa[i][j + 1] % MOD *
                           powermod(sa + sb + i - j, MOD - 2, MOD) % MOD) %
                      MOD;
        dp_sb[i][j] = ((sa + i) % MOD * dp_sb[i + 1][j] % MOD *
                           powermod(sa + sb + i - j, MOD - 2, MOD) % MOD +
                       (sb - j - 1 + MOD) % MOD * dp_sb[i][j + 1] % MOD *
                           powermod(sa + sb + i - j, MOD - 2, MOD) % MOD) %
                      MOD;
      }
    }
    for (int i = 1; i <= N; ++i) {
      if (aa[i]) {
        cout << gg[i] * dp_sa[0][0] % MOD << endl;
      } else {
        cout << gg[i] * dp_sb[0][0] % MOD << endl;
      }
    }
  }
  return 0;
}
