#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     function<long long(long long, long long)> power = [&](long long x,                                                           long long y) {       if (y == 0) {         return 1LL;       } else {         long long z = power(x, y / 2);         return y % 2 == 0 ? (z * z) % 998244353                           : ((z * z) % 998244353 * x) % 998244353;       }     };     auto div = [&](long long x) { return power(x, 998244353 - 2); };     long long n, m;     cin >> n >> m;     vector<bool> a((size_t)n);     vector<long long> w((size_t)n);     for (long long i = 0; i < n; i++) {       long long v;       cin >> v;       a[i] = v == 1;     }     for (long long i = 0; i < n; i++) {       cin >> w[i];     }     long long zeros = 0, ones = 0;     for (long long i = 0; i < n; i++) {       if (a[i]) {         ones += w[i];       } else {         zeros += w[i];       }     }     map<tuple<bool, long long, long long, long long, long long>, long long> dp;     function<long long(bool, long long, long long, long long, long long)> f =         [&](bool q, long long b, long long z, long long o, long long j) {           if (j >= m) {             return b;           }           auto it = dp.find({q, b, z, o, j});           if (it != dp.end()) {             return it->second;           }           long long r = 0;           if (q) {             r += b * f(q, b + 1, z, o, j + 1);             r += z * f(q, b, z - 1, o, j + 1);             r += o * f(q, b, z, o + 1, j + 1);           } else {             r += b * f(q, b - 1, z, o, j + 1);             r += z * f(q, b, z - 1, o, j + 1);             r += o * f(q, b, z, o + 1, j + 1);           }           r %= 998244353;           r *= div(b + z + o);           r %= 998244353;           return dp[{q, b, z, o, j}] = r;         };     for (long long i = 0; i < n; i++) {       cout << f(a[i], w[i], a[i] ? zeros : zeros - w[i],                 a[i] ? ones - w[i] : ones, 0)            << endl;     }     return 0;   }   