#include <bits/stdc++.h>
const int64_t mod = 998244353;
int gcd(int64_t a, int64_t b) {
  while (a != 0 && b != 0) {
    if (a >= b)
      a = a % b;
    else
      b = b % a;
  }
  return a + b;
}
struct Fraction {
  int64_t numerator;
  int64_t devider;
  Fraction(int64_t n = 0, int64_t d = 1) : numerator(n), devider(d){};
  const Fraction& operator+(const Fraction& rv) {
    if (rv.devider == devider) {
      numerator += rv.numerator;
      int64_t g = gcd(numerator, devider);
      numerator /= g;
      devider /= g;
      numerator %= mod;
      return *this;
    } else {
      numerator *= rv.devider;
      numerator %= mod;
      numerator += rv.numerator * devider;
      numerator %= mod;
      devider *= rv.devider;
      int64_t g = gcd(numerator, devider);
      numerator /= g;
      devider /= g;
      devider %= mod;
      return *this;
    }
  }
  const Fraction& operator*(const Fraction& rv) {
    numerator *= rv.numerator;
    devider *= rv.devider;
    int64_t g = gcd(numerator, devider);
    numerator /= g;
    devider /= g;
    numerator %= mod;
    devider %= mod;
    return *this;
  }
};
struct Item {
  Item(Fraction f, int64_t s) : possibility(f), sum(s){};
  Fraction possibility;
  int64_t sum;
};
void extended_euclid(int64_t a, int64_t b, int64_t& x, int64_t& y, int64_t& d) {
  int64_t q, r, x1, x2, y1, y2;
  if (b == 0) {
    d = a, x = 1, y = 0;
    return;
  }
  x2 = 1, x1 = 0, y2 = 0, y1 = 1;
  while (b > 0) {
    q = a / b, r = a - q * b;
    x = x2 - q * x1, y = y2 - q * y1;
    a = b, b = r;
    x2 = x1, x1 = x, y2 = y1, y1 = y;
  }
  d = a, x = x2, y = y2;
}
int main() {
  int64_t n, m;
  std::cin >> n >> m;
  std::vector<std::pair<int64_t, bool>> data;
  int64_t posWeight = 0, negWeight = 0;
  for (int64_t i = 0; i < n; ++i) {
    int64_t a;
    std::cin >> a;
    if (a == 0)
      data.push_back(std::make_pair(-1, false));
    else
      data.push_back(std::make_pair(-1, true));
  }
  for (auto& i : data) {
    int64_t w;
    std::cin >> w;
    i.first = w;
    if (i.second)
      posWeight += w;
    else
      negWeight += w;
  }
  std::map<int64_t, Item> posMap{
      std::make_pair(posWeight, Item(Fraction(1, 1), posWeight + negWeight))},
      negMap{std::make_pair(negWeight,
                            Item(Fraction(1, 1), posWeight + negWeight))};
  for (int64_t i = 0; i < m; ++i) {
    std::map<int64_t, Item> newPos, newNeg;
    for (auto j : posMap) {
      if (newPos.find(j.first + 1) == newPos.end()) {
        Fraction f(j.first, j.second.sum);
        f = f * j.second.possibility;
        newPos.insert(std::make_pair(j.first + 1, Item(f, j.second.sum + 1)));
      } else {
        Fraction f(j.first, j.second.sum);
        f = f * j.second.possibility;
        newPos.at(j.first + 1).possibility =
            newPos.at(j.first + 1).possibility + f;
      }
      if (newPos.find(j.first) == newPos.end() && j.second.sum > j.first) {
        Fraction f(j.second.sum - j.first, j.second.sum);
        f = f * j.second.possibility;
        newPos.insert(std::make_pair(j.first, Item(f, j.second.sum - 1)));
      } else if (j.second.sum > j.first) {
        Fraction f(j.second.sum - j.first, j.second.sum);
        f = f * j.second.possibility;
        newPos.at(j.first).possibility = newPos.at(j.first).possibility + f;
      }
    }
    for (auto j : negMap) {
      if (newNeg.find(j.first - 1) == newNeg.end() && j.first - 1 > 0) {
        Fraction f(j.first, j.second.sum);
        f = f * j.second.possibility;
        newNeg.insert(std::make_pair(j.first - 1, Item(f, j.second.sum - 1)));
      } else if (j.first - 1 > 0) {
        Fraction f(j.first, j.second.sum);
        f = f * j.second.possibility;
        newNeg.at(j.first - 1).possibility =
            newNeg.at(j.first - 1).possibility + f;
      }
      if (newNeg.find(j.first) == newNeg.end()) {
        Fraction f(j.second.sum - j.first, j.second.sum);
        f = f * j.second.possibility;
        newNeg.insert(std::make_pair(j.first, Item(f, j.second.sum + 1)));
      } else {
        Fraction f(j.second.sum - j.first, j.second.sum);
        f = f * j.second.possibility;
        newNeg.at(j.first).possibility = newNeg.at(j.first).possibility + f;
      }
    }
    posMap = newPos;
    negMap = newNeg;
  }
  Fraction pos, neg;
  for (auto i : posMap) pos = pos + Fraction(i.first, 1) * i.second.possibility;
  for (auto i : negMap) neg = neg + Fraction(i.first, 1) * i.second.possibility;
  for (auto i : data) {
    Fraction res;
    if (i.second)
      res = Fraction(i.first, posWeight) * pos;
    else
      res = Fraction(i.first, negWeight) * neg;
    int64_t d, x, y;
    extended_euclid(res.devider, mod, x, y, d);
    std::cout << (((x % mod + mod) % mod) * res.numerator) % mod << std::endl;
  }
  return 0;
}
