#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << endl;
  err(++it, args...);
}
const int mod = 1e9 + 7;
const long long MOD = 998244353;
long long power(long long x, long long y) {
  long long res = 1;
  x = x % MOD;
  while (y > 0) {
    if (y & 1) res = (res * x) % MOD;
    y = y >> 1;
    x = (x * x) % MOD;
  }
  return res;
}
int modInverse(long long a) { return power(a, MOD - 2); }
int nCrModPFermat(long long n, long long r) {
  if (r == 0) return 1;
  long long fac[n + 1];
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % MOD;
  return (fac[n] * modInverse(fac[r]) % MOD * modInverse(fac[n - r]) % MOD) %
         MOD;
}
int mul(int x, int y) { return (x * 1ll * y) % MOD; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, m;
  cin >> n >> m;
  long long ans = 0;
  if (n > 2) {
    ans = mul(nCrModPFermat(m, n - 1), mul(n - 2, power(2, n - 3)));
  }
  cout << ans;
}
