#include <bits/stdc++.h>
using namespace std;
long long p = 998244353;
long long apow(long long a, long long b) {
  long long s = 1;
  while (b) {
    if (b & 1) {
      s = s * a % p;
    }
    a = a * a % p;
    b >>= 1;
  }
  return s;
}
void exgcd(long long a, long long b, long long &x, long long &y) {
  if (!b) {
    x = 1;
    y = 0;
  } else {
    exgcd(b, a % b, y, x);
    y -= (a / b) * x;
  }
}
long long C(long long n, long long k) {
  long long aa = 1, bb = 1;
  for (long long i = 1; i <= n; i++) {
    aa = aa * i % p;
  }
  for (long long i = 1; i <= k; i++) {
    bb = bb * i % p;
  }
  for (long long i = 1; i <= n - k; i++) {
    bb = bb * i % p;
  }
  long long x = 1, y = 0;
  exgcd(bb, p, x, y);
  x = (x + p) % p;
  return aa * x % p;
}
int main() {
  long long n, m;
  cin >> n >> m;
  if (n == 2) {
    cout << "0" << endl;
    return 0;
  }
  long long lpl = apow(2, n - 3);
  long long cxk = n - 2;
  lpl = lpl * cxk % p;
  long long lgm = C(m, n - 1);
  lgm = lgm * lpl % p;
  cout << lgm << endl;
  return 0;
}
