The only difference between easy and hard versions is constraints.

Nauuo is a girl who loves random picture websites.

One day she made a random picture website by herself which includes n pictures.

When Nauuo visits the website, she sees exactly one picture. The website does not display each picture with equal probability. The i-th picture has a non-negative weight w_i, and the probability of the i-th picture being displayed is \frac{w_i}{∑_{j=1}^nw_j}. That is to say, the probability of a picture to be displayed is proportional to its weight.

However, Nauuo discovered that some pictures she does not like were displayed too often. 

To solve this problem, she came up with a great idea: when she saw a picture she likes, she would add 1 to its weight; otherwise, she would subtract 1 from its weight.

Nauuo will visit the website m times. She wants to know the expected weight of each picture after all the m visits modulo 998244353. Can you help her?

The expected weight of the i-th picture can be denoted by \frac {q_i} {p_i} where \gcd(p_i,q_i)=1, you need to print an integer r_i satisfying 0≤ r_i<998244353 and r_i⋅ p_i≡ q_i\pmod{998244353}. It can be proved that such r_i exists and is unique.

Input

The first line contains two integers n and m (1≤ n≤ 2⋅ 10^5, 1≤ m≤ 3000) — the number of pictures and the number of visits to the website.

The second line contains n integers a_1,a_2,…,a_n (a_i is either 0 or 1) — if a_i=0 , Nauuo does not like the i-th picture; otherwise Nauuo likes the i-th picture. It is guaranteed that there is at least one picture which Nauuo likes.

The third line contains n positive integers w_1,w_2,…,w_n (w_i ≥ 1) — the initial weights of the pictures. It is guaranteed that the sum of all the initial weights does not exceed 998244352-m.

Output

The output contains n integers r_1,r_2,…,r_n — the expected weights modulo 998244353.

Examples

Input


2 1
0 1
2 1


Output


332748119
332748119


Input


1 2
1
1


Output


3


Input


3 3
0 1 1
4 3 5


Output


160955686
185138929
974061117

Note

In the first example, if the only visit shows the first picture with a probability of \frac 2 3, the final weights are (1,1); if the only visit shows the second picture with a probability of \frac1 3, the final weights are (2,2).

So, both expected weights are \frac2 3⋅ 1+\frac 1 3⋅ 2=\frac4 3 .

Because 332748119⋅ 3≡ 4\pmod{998244353}, you need to print 332748119 instead of \frac4 3 or 1.3333333333.

In the second example, there is only one picture which Nauuo likes, so every time Nauuo visits the website, w_1 will be increased by 1.

So, the expected weight is 1+2=3.

Nauuo is very naughty so she didn't give you any hint of the third example.
#include <bits/stdc++.h>
using namespace std;
const int mm = 998244353;
long long w[210001], f[3111][3111], t0, t1, r0, r1, w0[210001], ans;
int i, j, k, n, m, a[210001];
void upd(long long &x, long long y) { x = (x + y) % mm; }
long long pw(long long b, long long p) {
  long long res = 1;
  for (; p; p >>= 1, b = b * b % mm)
    if (p & 1) res = res * b % mm;
  return res;
}
void work() {
  int i, j;
  long long z0, z1, iv;
  for (i = 0; i <= m; i++)
    for (j = 0; j <= m; j++) f[i][j] = 0;
  f[0][0] = 1;
  for (i = 0; i < m; i++)
    for (j = 0; j <= i; j++) {
      if (!f[i][j]) continue;
      z0 = t0 - j;
      z1 = t1 + (i - j);
      iv = pw((z1 + z0) % mm, mm - 2);
      upd(f[i + 1][j + 1], f[i][j] * iv % mm * z0 % mm);
      upd(f[i + 1][j], f[i][j] * iv % mm * z1 % mm);
    }
  for (r1 = r0 = i = 0; i <= m; i++) {
    if (!f[m][i]) continue;
    upd(r0, (long long)i * f[m][i] % mm);
    upd(r1, (long long)(m - i) * f[m][i] % mm);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  t0 = t1 = 0;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) {
    scanf("%d", &k);
    w[i] = w0[i] = k;
    if (a[i])
      t1 += k;
    else
      t0 += k;
  }
  work();
  for (i = 1; i <= n; i++) {
    if (!a[i]) {
      ans = w[i] - r0 * w[i] % mm * pw(t0, mm - 2) % mm;
      ans = (ans % mm + mm) % mm;
    } else {
      ans = w[i] + r1 * w[i] % mm * pw(t1, mm - 2) % mm;
      ans %= mm;
    }
    printf("%d\n", (int)ans);
  }
  return 0;
}
