#include <bits/stdc++.h>
using namespace std;
long long int powM(long long int x, long long int y, long long int m) {
  if (y == 0) return 1;
  long long int p = powM(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
long long int power(long long int x, long long int y, long long int p) {
  long long 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;
}
long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2, p);
}
long long int nCrModPFermat(long long int n, long long int r, long long int p) {
  if (r == 0) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
int main() {
  long long int n, m;
  cin >> n >> m;
  if (n == 2)
    cout << "0\n";
  else
    cout << ((powM(2, n - 3, 998244353) * nCrModPFermat(m, n - 1, 998244353) %
              998244353) *
             (n - 2)) %
                998244353
         << endl;
  return 0;
}
