#include <bits/stdc++.h>
using namespace std;
const int N = 1000001;
long long factorialNumInverse[N + 1];
long long naturalNumInverse[N + 1];
long long fact[N + 1];
void InverseofNumber(long long 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 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 p) {
  fact[0] = 1;
  for (int i = 1; i <= N; i++) {
    fact[i] = (fact[i - 1] * i) % p;
  }
}
long long Binomial(long long N, long long R, long long p) {
  long long ans =
      ((fact[N] * factorialNumInverse[R]) % p * factorialNumInverse[N - R]) % p;
  return ans;
}
int main() {
  long long p = 998244353;
  InverseofNumber(p);
  InverseofFactorial(p);
  factorial(p);
  long long n, m;
  cin >> n >> m;
  if (n == 2) {
    cout << 0;
    return 0;
  }
  long long ans = Binomial(m, n - 1, p);
  ans *= (n - 2);
  ans = ans % 998244353;
  if (n == 3) {
    cout << ans;
    return 0;
  }
  long long i;
  for (i = 0; i < n - 3; i++) {
    ans *= 2;
    ans = ans % 998244353;
  }
  cout << ans << endl;
  return 0;
}
