#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
istream& in(cin);
ostream& out(cout);
const long long mod2 = 1000 * 1000 * 1000 + 7;
const long long inf = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const long long mod = 998244353;
const long long N = 1000 * 100 + 1;
const long double pi = 3.141592653589793;
long long power(long long x, long long y, long long p = LLONG_MAX) {
  long long res = 1;
  x %= p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long ncr(long long n, long long r, long long m) {
  if (r > n) return 0;
  long long a = 1, b = 1, i;
  for (i = 0; i < r; i++) {
    a = (a * n) % m;
    --n;
  }
  while (r) {
    b = (b * r) % m;
    --r;
  }
  return (a * power(b, m - 2, m)) % m;
}
void solve() {
  long long n, m;
  in >> n >> m;
  if (n == 2) {
    out << 0;
    return;
  }
  long long ans = ncr(m, n - 1, mod);
  ans = (ans % mod * (n - 2) % mod) % mod;
  ans = (ans % mod * power(2, (n - 3), mod) % mod) % mod;
  out << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  { solve(); }
  return 0;
}
