#include <bits/stdc++.h>
using namespace std;
const long long BIG = 1000000000000000000LL;
void solve();
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
template <const long long MOD>
struct ModInt {
  long long x;
  ModInt() : x(0) {}
  ModInt(long long u) : x(u) {}
  ModInt(const ModInt& m) : x(m.x) {}
  ModInt& operator=(const ModInt& m) {
    x = m.x;
    return *this;
  }
  friend bool operator==(const ModInt& a, const ModInt& b) {
    return a.x == b.x;
  }
  friend bool operator!=(const ModInt& a, const ModInt& b) {
    return a.x != b.x;
  }
  friend bool operator<(const ModInt& a, const ModInt& b) { return a.x < b.x; }
  ModInt& operator+=(const ModInt& m) {
    x += m.x;
    if (x >= MOD) x -= MOD;
    return *this;
  }
  ModInt& operator-=(const ModInt& m) {
    x -= m.x;
    if (x < 0) x += MOD;
    return *this;
  }
  ModInt& operator*=(const ModInt& m) {
    x = (x * m.x) % MOD;
    return *this;
  }
  friend ModInt operator-(const ModInt& a) {
    ModInt res(a);
    if (res.x) res.x = MOD - res.x;
    return res;
  }
  friend ModInt operator+(const ModInt& a, const ModInt& b) {
    return ModInt(a) += ModInt(b);
  }
  friend ModInt operator-(const ModInt& a, const ModInt& b) {
    return ModInt(a) -= ModInt(b);
  }
  friend ModInt operator*(const ModInt& a, const ModInt& b) {
    return ModInt(a) *= ModInt(b);
  }
  static long long fp(long long u, long long k) {
    if (k == 0) return 1;
    long long res = fp(u, k / 2);
    res = (res * res) % MOD;
    if (k & 1) res = (res * u) % MOD;
    return res;
  }
  ModInt fastpow(long long k) { return ModInt(fp(x, k)); }
  ModInt inv() { return ModInt(fp(x, MOD - 2)); }
};
const long long m998 = 998244353;
using Num = ModInt<m998>;
const long long lim = 51;
long long nbPhotos, nbVisits;
long long isLike[lim];
long long iniExcp[lim];
long long sumLike = 0, sumHate = 0;
const long long maxDelta = 2 * lim;
const long long zeroDelta = lim;
Num dpLike[2][2 * lim][maxDelta][maxDelta];
Num dpHate[2][2 * lim][maxDelta][maxDelta];
const long long MAXINV = 5 * lim * lim;
Num inv[MAXINV];
void solve() {
  cin >> nbPhotos >> nbVisits;
  for (long long i = (0); i < (nbPhotos); ++i) cin >> isLike[i];
  for (long long i = (1); i < (MAXINV); ++i) inv[i] = Num(i).inv();
  for (long long i = (0); i < (nbPhotos); ++i) {
    cin >> iniExcp[i];
    if (isLike[i])
      sumLike += iniExcp[i];
    else
      sumHate += iniExcp[i];
  }
  for (long long watched = (0); watched < (2 * lim); ++watched)
    for (long long a = (0); a < (maxDelta); ++a)
      for (long long b = (0); b < (maxDelta); ++b) {
        dpLike[0][watched][a][b] = dpHate[0][watched][a][b] = Num(watched);
      }
  for (long long iVisit = (1); iVisit < (nbVisits + 1); ++iVisit) {
    long long cur = iVisit % 2;
    long long prev = cur ^ 1;
    long long scope = nbVisits - iVisit;
    for (long long watched = (0); watched < (lim + scope); ++watched)
      for (long long memLike = (zeroDelta - scope);
           memLike < (zeroDelta + scope + 1); ++memLike)
        for (long long memHate = (zeroDelta - scope);
             memHate < (zeroDelta + scope + 1); ++memHate) {
          long long newLike = sumLike + (memLike - zeroDelta);
          long long newHate = sumHate + (memHate - zeroDelta);
          Num& resLike = dpLike[cur][watched][memLike][memHate];
          Num& resHate = dpHate[cur][watched][memLike][memHate];
          resLike.x = resHate.x = 0;
          long long tot = newLike + newHate;
          if (watched > 0) {
            resLike +=
                Num(watched) * dpLike[prev][watched + 1][memLike + 1][memHate];
            resHate +=
                Num(watched) * dpHate[prev][watched - 1][memLike][memHate - 1];
          }
          if (newLike > 0) {
            if (newLike > watched)
              resLike += Num(newLike - watched) *
                         dpLike[prev][watched][memLike + 1][memHate];
            resHate +=
                Num(newLike) * dpHate[prev][watched][memLike + 1][memHate];
          }
          if (newHate > 0) {
            resLike +=
                Num(newHate) * dpLike[prev][watched][memLike][memHate - 1];
            if (newHate > watched)
              resHate += Num(newHate - watched) *
                         dpHate[prev][watched][memLike][memHate - 1];
          }
          resLike *= inv[tot];
          resHate *= inv[tot];
        }
  }
  long long partLook = nbVisits % 2;
  for (long long i = (0); i < (nbPhotos); ++i) {
    long long ini = iniExcp[i];
    if (isLike[i]) {
      cout << dpLike[partLook][ini][zeroDelta][zeroDelta].x << "\n";
    } else {
      cout << dpHate[partLook][ini][zeroDelta][zeroDelta].x << "\n";
    }
  }
}
