#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long Mod = 998244353;
const long double Pi = acos(-1);
long long n, m;
long long Fac[2000009];
long long Mul(long long X, long long Y) { return (X * Y) % Mod; }
long long Pow(long long X, long long Y) {
  if (!Y) return 1ll;
  long long Ret = Pow(X, Y / 2ll);
  Ret = Mul(Ret, Ret);
  if (Y & 1) Ret = Mul(Ret, X);
  return Ret;
}
long long Inv(long long X) { return Pow(X, Mod - 2ll); }
long long Div(long long X, long long Y) { return Mul(X, Inv(Y)) % Mod; }
long long NumOfWays(long long From, long long Choose) {
  return Div(Fac[From], Mul(Fac[Choose], Fac[From - Choose]));
}
int main() {
  cin >> n >> m;
  if (n == 2) cout << 0 << endl, exit(0);
  Fac[0] = 1ll;
  for (long long i = 1; i <= m; i++) Fac[i] = Mul(Fac[i - 1], i);
  cout << Mul(NumOfWays(m, n - 1), Mul(n - 2, Pow(2, n - 3))) << endl;
}
