#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long nax = 1e6 + 10;
vector<long long> f(nax), invf(nax);
long long binpow(long long a, long long b) {
  long long res = 1;
  a %= mod;
  while (b) {
    if ((b & 1)) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
void init() {
  f[0] = 1;
  for (long long i = 1; i < nax; i++) f[i] = (f[i - 1] * i) % mod;
  invf[nax - 1] = binpow(f[nax - 1], mod - 2);
  for (long long i = nax - 2; i >= 0; i--)
    invf[i] = (invf[i + 1] * (i + 1)) % mod;
  return;
}
long long ncr(long long n, long long r) {
  if (!r) return 1;
  if (n < r || r < 0) return 0;
  long long ans = (f[n] * invf[n - r]) % mod;
  return (ans * invf[r]) % mod;
}
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  init();
  long long n, m;
  cin >> n >> m;
  long long ans = (ncr(m, n - 1) * (n - 2)) % mod;
  long long ans1 = 0;
  for (long long i = 2; i < n; i++) {
    long long xx = ncr(n - 3, i - 2);
    ans1 += xx;
    ans1 %= mod;
  }
  ans *= ans1;
  ans %= mod;
  cout << ans;
}
