#include <bits/stdc++.h>
using namespace std;
const long long M = 3010, MOD = 998244353;
long long dp[M][M], isum[2 * M];
long long fpow(long long a, long long p, long long m) {
  if (p == 0) return 1;
  long long b = fpow(a, p / 2, m);
  b = (b * b) % m;
  if (p & 1) b = (b * a) % m;
  return b;
}
long long inv(long long x) { return fpow(x % MOD, MOD - 2, MOD); }
long long mul(long long a, long long b) { return (a * b) % MOD; }
long long add(long long a, long long b) {
  if (a + b >= MOD)
    return a + b - MOD;
  else
    return a + b;
}
long long fix(long long x) { return ((x % MOD) + MOD) % MOD; }
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<long long> a(n), b(n);
  for (long long i = (0); i < (n); ++i) cin >> a[i];
  long long sp = 0, sn = 0, cp = 0, cn = 0;
  for (long long i = (0); i < (n); ++i) {
    cin >> b[i];
    if (a[i] == 0)
      sn += b[i], cn++;
    else
      sp += b[i], cp++;
  }
  long long r2 = inv(2);
  dp[0][0] = 1;
  for (long long i = (0); i < (m + 1); ++i)
    isum[m + i] = inv(fix(sp + sn + i)), isum[m - i] = inv(fix(sp + sn - i));
  for (long long i = (0); i < (m + 1); ++i) {
    for (long long j = (0); j < (m + 1); ++j) {
      long long is = isum[m + i - j];
      dp[i + 1][j] = add(dp[i + 1][j], mul(dp[i][j], mul(sp + i, is)));
      dp[i][j + 1] = add(dp[i][j + 1], mul(dp[i][j], mul(sn - j, is)));
    }
  }
  long long mp = 0, mn = 0;
  for (long long i = (0); i < (m + 1); ++i) {
    mp = add(mp, mul(i, dp[i][m - i]));
    mn = add(mn, mul(i, dp[m - i][i]));
  }
  mp = mul(mp, inv(sp));
  mn = mul(mn, inv(sn));
  for (long long i = (0); i < (n); ++i) {
    if (a[i] == 0)
      cout << add(b[i], MOD - mul(mn, b[i])) << ' ';
    else
      cout << add(b[i], mul(mp, b[i])) << ' ';
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
