#include <bits/stdc++.h>
using namespace std;
long long int q = 998244353;
const int N = 1000001;
long long int factorialNumInverse[N + 1];
long long int naturalNumInverse[N + 1];
long long int fact[N + 1];
void InverseofNumber(long long int p) {
  naturalNumInverse[0] = naturalNumInverse[1] = 1;
  for (int i = 2; i <= N; i++)
    naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(long long int p) {
  factorialNumInverse[0] = factorialNumInverse[1] = 1;
  for (int i = 2; i <= N; i++)
    factorialNumInverse[i] =
        (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(long long int p) {
  fact[0] = 1;
  for (int i = 1; i <= N; i++) {
    fact[i] = (fact[i - 1] * i) % p;
  }
}
long long int Binomial(long long int N, long long int R, long long int p) {
  long long int ans =
      ((fact[N] * factorialNumInverse[R]) % p * factorialNumInverse[N - R]) % p;
  return ans;
}
int power(long long int x, unsigned int y, int p) {
  int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  long long int ans = 0;
  InverseofNumber(q);
  InverseofFactorial(q);
  factorial(q);
  if (n > 3) {
    ans = (power(2, n - 3, q));
    ans *= Binomial(m, n - 1, q);
    ans %= q;
    ans *= (n - 2);
    ans %= q;
    ans += q;
    ans %= q;
  } else {
    ans = Binomial(m, n - 1, q);
    ans *= (n - 2);
    ans %= q;
    ans += q;
    ans %= q;
  }
  cout << ans % q;
  return 0;
}
