#include <bits/stdc++.h>
using namespace std;
long long fpw(long long n, long long p) {
  if (p == 0) return 1LL;
  long long tmp = fpw(n, p / 2);
  tmp *= tmp;
  tmp %= 998244353;
  if (p % 2 == 1) {
    tmp *= n;
    tmp %= 998244353;
  }
  return tmp;
}
long long inv(long long k) { return fpw(k, 998244353 - 2); }
long long pre[3005];
long long inv2(long long k) {
  if (k > 3000) return inv(k);
  return pre[k];
}
long long n, m;
long long a[100];
long long w[100];
long long dp[55][105][105];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  for (int i = 1; i <= 3000; i++) {
    pre[i] = inv(i);
  }
  for (int i = 0; i < n; i++) {
    long long cntoth = 0, wall = 0, w1 = 0, w0 = 0;
    for (int j = 0; j < n; j++) {
      if (i != j) {
        cntoth += a[j];
        if (a[j] == 1)
          w1 += w[j];
        else
          w0 += w[j];
      }
      wall += w[j];
    }
    long long ans = 0;
    dp[0][51][51] = 1;
    for (int j = 1; j <= m; j++) {
      for (int k = 1; k <= 101; k++) {
        for (int l = 1; l <= 51; l++) {
          int l2 = 51 + (j - abs(51 - k) - abs(51 - l));
          if (l2 < 51) continue;
          dp[j][k][l] = 0;
          if (a[i] == 0)
            dp[j][k][l] +=
                ((dp[j - 1][k + 1][l] * (w[i] + (k + 1) - 51)) % 998244353) *
                inv2(wall + (k + 1) - 51 + l - 51 + l2 - 51);
          else
            dp[j][k][l] +=
                ((dp[j - 1][k - 1][l] * (w[i] + (k - 1) - 51)) % 998244353) *
                inv2(wall + (k - 1) - 51 + l - 51 + l2 - 51);
          dp[j][k][l] +=
              ((dp[j - 1][k][l] * (w1 + ((l2 - 1) - 51))) % 998244353) *
              inv2(wall + k - 51 + l - 51 + (l2 - 1) - 51);
          dp[j][k][l] +=
              ((dp[j - 1][k][l + 1] * (w0 + ((l + 1) - 51))) % 998244353) *
              inv2(wall + k - 51 + (l + 1) - 51 + l2 - 51);
          dp[j][k][l] %= 998244353;
          if (j == m) ans += dp[j][k][l] * (w[i] + k - 51);
          ans %= 998244353;
        }
      }
    }
    printf("%lld\n", ans);
  }
}
