#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long long fac[1000005];
void init() {
  fac[0] = fac[1] = 1;
  for (int i = 2; i <= 300000; i++) fac[i] = fac[i - 1] * i % mod;
}
long long exgcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1, y = 0;
    return a;
  }
  long long ret = exgcd(b, a % b, y, x);
  y -= a / b * x;
  return ret;
}
long long inv2(int a) {
  long long x, y;
  long long d = exgcd(a, mod, x, y);
  return d == 1 ? (x % mod + mod) % mod : -1;
}
long long qpow(long long a, long long k) {
  long long s = 1;
  while (k) {
    if (k & 1) s = s * a % mod;
    a = a * a % mod;
    k >>= 1;
  }
  return s;
}
long long inv(long long a) { return qpow(a, mod - 2); }
long long C(long long n, long long m) {
  return fac[n] * inv(fac[m]) % mod * inv(fac[n - m]) % mod;
}
int main() {
  init();
  int n, m;
  cin >> n >> m;
  if (n == 2)
    cout << 0 << endl;
  else
    cout << (((qpow(2, n - 3) * C(m, n - 1)) % mod) * (n - 2)) % mod;
}
