#include <bits/stdc++.h>
using namespace std;
int N, M;
int a[200005], w[200005];
long long qpow(long long x, int n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % int(998244353);
    x = x * x % int(998244353);
    n /= 2;
  }
  return res;
}
long long inv(long long x) { return qpow(x, int(998244353) - 2); }
long long s[2];
long long NN;
int r[2 * 3005];
long long d[3005][3005], g[3005][3005];
long long dfs0(int i, int j) {
  if (d[i][j] != -1) return d[i][j];
  if (i > M) return d[i][j] = 1;
  long long ans = 0;
  long long p0 = 0, p1 = 0;
  long long deno = r[M + i - 1 - 2 * j];
  if (s[0] - j - 1 >= 0) p0 = (s[0] - j - 1) * deno % int(998244353);
  if (s[1] + i - 1 - j >= 0) p1 = (s[1] + i - 1 - j) * deno % int(998244353);
  if (p0) ans = p0 * dfs0(i + 1, j + 1) % int(998244353);
  if (p1) ans = (ans + p1 * dfs0(i + 1, j) % int(998244353)) % int(998244353);
  return d[i][j] = ans;
}
long long dfs1(int i, int j) {
  if (g[i][j] != -1) return g[i][j];
  if (i > M) return g[i][j] = 1;
  long long ans = 0;
  long long p0 = 0, p1 = 0, p2 = 0;
  long long deno = r[M + i - 1 - 2 * j];
  if (s[0] - j >= 0) p0 = (s[0] - j) * deno % int(998244353);
  if (s[1] + i - 1 - j - 1 >= 0)
    p1 = (s[1] + i - 1 - j - 1) * deno % int(998244353);
  p2 = deno;
  if (p0) ans = p0 * dfs1(i + 1, j + 1) % int(998244353);
  if (p1) ans = (ans + p1 * dfs1(i + 1, j) % int(998244353)) % int(998244353);
  ans = (ans + 2 * p2 % int(998244353) * dfs1(i + 1, j) % int(998244353)) %
        int(998244353);
  return g[i][j] = ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> N >> M;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= N; i++) {
    cin >> w[i];
    s[a[i]] += w[i];
  }
  NN = s[0] + s[1];
  for (int i = -M; i <= M; i++) {
    r[M + i] = inv(NN + i);
  }
  memset(d, -1, sizeof(d));
  memset(g, -1, sizeof(g));
  for (int i = 1; i <= N; i++) {
    if (a[i] == 0) cout << w[i] * dfs0(1, 0) % int(998244353) << endl;
    if (a[i] == 1) cout << w[i] * dfs1(1, 0) % int(998244353) << endl;
  }
  return 0;
}
