#include <bits/stdc++.h>
using namespace std;
int N, M;
int dp[2][60][60][60 * 2];
int arr[60];
int likes[60];
int sum[2];
int add(int a, int b) { return (a + b) % 998244353; }
int sub(int a, int b) { return (998244353 + a - b) % 998244353; }
int prod(int a, int b) { return 1LL * a * b % 998244353; }
int power(int a, int r) {
  if (!r) return 1;
  int mid = power(a, r / 2);
  mid = prod(mid, mid);
  if (r % 2) mid = prod(mid, a);
  return mid;
}
int inv(int a) { return power(a, 998244353 - 2); }
int get(int day, int nhit, int cur, int idx) {
  if (day == M) return cur;
  if (cur <= 0 || nhit > sum[0]) return 0;
  if (dp[idx][day][nhit][cur] >= 0) return dp[idx][day][nhit][cur];
  int phit = day - nhit;
  int s[2];
  s[0] = sum[0] - nhit;
  s[1] = sum[1] + phit;
  int divider = inv(add(s[0], s[1]));
  int chance1 = get(day + 1, nhit + 1, cur, idx);
  int chance2 = get(day + 1, nhit, cur, idx);
  int chance3;
  int ans;
  if (idx) {
    chance3 = get(day + 1, nhit, cur + 1, idx);
    ans = prod(chance1, prod(s[0], divider));
    ans = add(ans, prod(chance2, prod(sub(s[1], cur), divider)));
    ans = add(ans, prod(chance3, prod(cur, divider)));
  } else {
    chance3 = get(day + 1, nhit + 1, cur - 1, idx);
    ans = prod(chance1, prod(sub(s[0], cur), divider));
    ans = add(ans, prod(chance2, prod(s[1], divider)));
    ans = add(ans, prod(chance3, prod(cur, divider)));
  }
  dp[idx][day][nhit][cur] = ans;
  return ans;
}
int main(void) {
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> likes[i];
  for (int i = 0; i < N; i++) {
    cin >> arr[i];
    sum[likes[i]] += arr[i];
  }
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < 60; j++) {
      for (int k = 0; k < 60 * 2; k++) {
        dp[0][i][j][k] = -1;
        dp[1][i][j][k] = -1;
      }
    }
  }
  for (int i = 0; i < N; i++) cout << get(0, 0, arr[i], likes[i]) << endl;
  return 0;
}
