#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
using li = long long;
using ld = long double;
void solve(bool);
void precalc();
clock_t start;
int main() {
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  cout << fixed;
  precalc();
  while (t--) {
    solve(true);
  }
  cout.flush();
  return 0;
}
template <typename T>
T binpow(T q, T w, T mod) {
  if (!w) return 1 % mod;
  if (w & 1) return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}
template <typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template <typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}
template <typename T>
void make_unique(vector<T>& vec) {
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
}
template <typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}
template <typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}
mt19937 rng(
    (unsigned long long)chrono::steady_clock::now().time_since_epoch().count());
void precalc() {}
const li mod = 998244353;
const li C = 3010;
li dp[C][C];
void add(li& cur, li val) {
  cur += val;
  cur %= mod;
}
void solve(__attribute__((unused)) bool read) {
  li n, m;
  if (read) {
    cin >> n >> m;
  } else {
    n = 200000;
    m = 3000;
  }
  vector<li> a(n), w(n);
  for (li i = 0; i < n; ++i) {
    if (read) {
      cin >> a[i];
    } else {
      a[i] = rand() % 2;
    }
  }
  li sums[2] = {0, 0};
  for (li i = 0; i < n; ++i) {
    if (read) {
      cin >> w[i];
    } else {
      w[i] = rand() % (li)1e5 + 1;
    }
    sums[a[i]] += w[i];
  }
  dp[0][0] = 1;
  const li SHIFT = 2 * m;
  vector<li> cached_rev(2 * SHIFT + 5);
  for (li i = 0; i < cached_rev.size(); ++i) {
    cached_rev[i] = binpow(sums[0] + sums[1] + i - SHIFT, mod - 2, mod);
  }
  for (li pref = 0; pref < m; ++pref) {
    for (li p = 0; p <= pref; ++p) {
      li cur_dp = dp[pref][p];
      if (cur_dp == 0) {
        continue;
      }
      li mins = pref - p;
      li mult = cached_rev[SHIFT + p - mins];
      add(dp[pref + 1][p], (sums[0] - mins) * mult % mod * cur_dp);
      add(dp[pref + 1][p + 1], (sums[1] + p) * mult % mod * cur_dp);
    }
  }
  vector<li> frac(n);
  for (li i = 0; i < n; ++i) {
    frac[i] = w[i] * binpow(sums[a[i]], mod - 2, mod) % mod;
    if (!a[i]) {
      frac[i] = -frac[i];
    }
  }
  vector<li> new_sums(2, 0);
  for (li x = 0; x <= m; ++x) {
    li y = m - x;
    add(new_sums[0], dp[m][x] * y);
    add(new_sums[1], dp[m][x] * x);
  }
  for (li i = 0; i < n; ++i) {
    li x = (frac[i] * new_sums[a[i]] + w[i]) % mod;
    if (x < 0) {
      x += mod;
    }
    if (read) {
      cout << x << "\n";
    }
  }
}
