#include <bits/stdc++.h>
using namespace std;
long long MOD = 998244353;
int factorials[200001];
int add(int x, int y) {
  long long c = x + y;
  return (c + MOD) % MOD;
}
int multiply(int x, int y) { return (1ll * x * y) % MOD; }
void precalculate(int x) {
  factorials[0] = 1;
  for (int i = 1; i <= x; i++) {
    factorials[i] = multiply(factorials[i - 1], i);
  }
}
int power(int x, int y) {
  int pow = y;
  int ret = 1;
  int val = x;
  while (pow != 0) {
    if (pow % 2 == 1) {
      ret = multiply(ret, val);
    }
    val = multiply(val, val);
    pow /= 2;
  }
  return ret;
}
int divide(int x, int y) { return multiply(x, power(y, MOD - 2)); }
int binomial(int n, int k) {
  return divide(factorials[n], multiply(factorials[n - k], factorials[k]));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  if (N == 2) {
    cout << 0;
    return 0;
  }
  precalculate(M);
  int ans = multiply(multiply(binomial(M, N - 1), N - 2), power(2, N - 3));
  cout << ans;
  return 0;
}
