#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const long long MX = 2e5 + 5;
const long long INF = 1e18;
const long double PI = acos((long double)-1);
long long fact[200005];
long long mmi(long long push, long long m, long long mod) {
  long long res = 1;
  while (m) {
    if (m & 1) res *= push;
    push *= push;
    push %= mod;
    res %= mod;
    m >>= 1;
  }
  return res % mod;
}
long long comb(long long n, long long r) {
  long long num, dem;
  num = (fact[n] * (mmi(fact[n - r], MOD - 2, MOD))) % MOD;
  dem = fact[r];
  long long MMI1 = mmi(dem, MOD - 2, MOD);
  long long ways1 = (num * MMI1) % MOD;
  return ways1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long kk = 1;
  fact[0] = 1;
  for (int i = (1); i <= (200000); i++)
    fact[i] = (kk * i) % MOD, kk = (kk * i) % MOD;
  long long n, m;
  cin >> n >> m;
  long long ways = comb(m, n - 1);
  long long intt = 0;
  for (int i = (1); i <= (n - 2); i++) {
    intt += comb(n - 2, i) * i;
    intt %= MOD;
  }
  long long final = intt * ways;
  final %= MOD;
  cout << final;
}
