#include <bits/stdc++.h>
using namespace std;
inline long long madd(long long a, long long b) {
  a %= 998244353;
  b %= 998244353;
  return (a + b) % 998244353;
}
inline long long msub(long long a, long long b) {
  a %= 998244353;
  b %= 998244353;
  a += 998244353;
  return (a - b) % 998244353;
}
inline long long mmul(long long a, long long b) {
  a %= 998244353;
  b %= 998244353;
  return (a * b) % 998244353;
}
inline long long mpow(long long a, long long r) {
  long long res = 1;
  while (r > 0) {
    if (r & 1) res = res * a % 998244353;
    a = a * a % 998244353;
    r >>= 1;
  }
  return res;
}
inline long long minv(long long a) {
  a %= 998244353;
  long long b = 998244353, u = 0, v = 1;
  while (a) {
    long long t = b / a;
    b -= t * a;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  if (u < 0) u += 998244353;
  return u;
}
inline long long mdiv(long long a, long long b) {
  a %= 998244353;
  a *= minv(b);
  return a % 998244353;
}
struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) {}
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
    return x != y;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
  int size(int x) { return -data[root(x)]; }
};
long long fact[200001];
long long fact_inv[200001];
inline long long combi(int a, int b) {
  return mmul(fact[a], mmul(fact_inv[b], fact_inv[a - b]));
}
int main() {
  fact[0] = 1;
  fact_inv[0] = 1;
  for (long long i = (0); i < (200000); ++i) {
    fact[i + 1] = (fact[i] * (i + 1)) % 998244353;
    fact_inv[i + 1] = minv(fact[i + 1]);
  }
  long long n, m;
  cin >> n >> m;
  long long res = combi(m, n - 1);
  long long tomul = 0;
  for (long long i = (1); i < (n - 1); ++i)
    tomul = madd(tomul, mmul(combi(n - 2, i), i));
  res = mmul(res, tomul);
  cout << res;
  return 0;
}
