#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 998244353;
int mpow(int b, int e) {
  int res = 1;
  while (e) {
    if (e & 1) res = (long long)res * b % MOD;
    b = (long long)b * b % MOD;
    e >>= 1;
  }
  return res;
}
int comb(int n, int k) {
  k = max(k, n - k);
  int res = 1;
  for (int i = k + 1; i <= n; i++) res = (long long)res * i % MOD;
  int inv = 1;
  for (int i = 2; i <= n - k; i++) inv = (long long)inv * i % MOD;
  res = (long long)res * mpow(inv, MOD - 2) % MOD;
  return res;
}
int main() {
  int n, m;
  cin >> n >> m;
  int ans =
      n <= 2 ? 0
             : (long long)comb(m, n - 1) * mpow(2, n - 3) % MOD * (n - 2) % MOD;
  cout << ans << '\n';
}
