Your task is to calculate the number of arrays such that:  each array contains $n$ elements;  each element is an integer from $1$ to $m$;  for each array, there is exactly one pair of equal elements;  for each array $a$, there exists an index $i$ such that the array is strictly ascending before the $i$-th element and strictly descending after it (formally, it means that $a_j < a_{j + 1}$, if $j < i$, and $a_j > a_{j + 1}$, if $j \ge i$). 


-----Input-----

The first line contains two integers $n$ and $m$ ($2 \le n \le m \le 2 \cdot 10^5$).


-----Output-----

Print one integer — the number of arrays that meet all of the aforementioned conditions, taken modulo $998244353$.


-----Examples-----
Input
3 4

Output
6

Input
3 5

Output
10

Input
42 1337

Output
806066790

Input
100000 200000

Output
707899035



-----Note-----

The arrays in the first example are:  $[1, 2, 1]$;  $[1, 3, 1]$;  $[1, 4, 1]$;  $[2, 3, 2]$;  $[2, 4, 2]$;  $[3, 4, 3]$.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Combinatorics

Mathematics


Solutions:
mod = 998244353
frac = [1] * 200001
for i in range(1, 200001):
	frac[i] = frac[i - 1] * i % mod

def C(a, b):
	return frac[a] * pow(frac[a - b], mod - 2, mod) % mod * pow(frac[b], mod - 2, mod) % mod
(n, m) = map(int, input().split())
(p, ans) = (0, 0)
for i in range(n - 1):
	p = (p + C(n - 2, i)) % mod
for i in range(m, n - 2, -1):
	ans = (ans + C(i - 1, n - 2) * (n - 2) * p // 2) % mod
print(ans)


(n, m) = map(int, input().split())
md = 998244353

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
if n == 2:
	print('0')
else:
	ans1 = 1
	for i in range(n - 3):
		ans1 *= 2
		ans1 %= md
	ans1 = ans1 % md * (n - 2) % md % md
	t = ncr(m, n - 1, md)
	ans1 = ans1 % md * t % md % md
	print(ans1)


from collections import Counter
from collections import defaultdict as dfd
from bisect import bisect, bisect_left
from math import sqrt, gcd, ceil, factorial
from heapq import heapify, heappush, heappop
MOD = 998244353
inf = float('inf')
ans_ = []

def nin():
	return int(input())

def ninf():
	return int(file.readline())

def st():
	return input().strip()

def stf():
	return file.readline().strip()

def read():
	return list(map(int, input().strip().split()))

def readf():
	return list(map(int, file.readline().strip().split()))

def facto():
	N = 2 * 10 ** 5 + 1
	facto = [0] * N
	facto[0] = 1
	i = 1
	for i in range(1, N):
		facto[i] = facto[i - 1] * i % MOD
	return facto

def solve():
	fact = facto()
	(n, m) = read()
	ans = fact[m] * pow(fact[m - n + 1] * fact[n - 1], MOD - 2, MOD) % MOD
	ans *= (n - 2) * pow(2, n - 3, MOD) % MOD
	ans %= MOD
	ans_.append(ans)
solve()
for i in ans_:
	print(i)


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
mod = 998244353

def modPow(x, y, p):
	(res, x) = (1, x % p)
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		(y, x) = (y >> 1, x * x % p)
	return res

def modInv(s):
	return modPow(s, mod - 2, mod)
(n, m) = mapi()
ans = 0
cur = 1
for i in range(1, n - 2):
	cur = cur * 2 % mod
cur = cur * (n - 2) % mod
ans = (ans + cur) % mod
x = 1
y = n - 2
cumx = n
while cumx <= m:
	cur = cur * (y + x) % mod
	cur = cur * modInv(x) % mod
	ans = (ans + cur) % mod
	cumx += 1
	x += 1
ans %= mod
print(int(ans))


(n, m) = map(int, input().split())
f = [1]
for i in range(m):
	f += (f[-1] * (i + 1) % 998244353,)
print((n - 2) * pow(2, n - 3, 998244353) * f[m] * pow(f[n - 1] * f[m - n + 1], 998244351, 998244353) % 998244353)


MOD = 998244353

def powr(n, N):
	temp = 1
	while N > 0:
		if N % 2 != 0:
			temp = temp * n % MOD
		n = n * n % MOD
		N = N // 2
	return temp % MOD

def MODI(a, b):
	ans = powr(a, b) % MOD
	return ans

def kk(n, k, MOD):
	t1 = 1
	t2 = 1
	for i in range(0, k):
		t1 = t1 * (n - i) % MOD
	for i in range(1, k + 1):
		t2 = t2 * i % MOD
	t = MODI(t2, MOD - 2)
	t3 = t1 * t % MOD
	return t3
(n, m) = map(int, input().split())
ans = kk(m, n - 1, MOD)
ans = ans * (n - 2) % MOD
ans = ans * (powr(2, n - 3) % MOD) % MOD
print(ans)


M = 998244353

def count_the_arrays(n, m):
	comb = c(m, n - 1)
	result = comb * ((n - 2) % M) % M * pow(2, n - 3, M) % M
	return result

def factorial(m):
	facts = [1 for _ in range(m + 1)]
	for n in range(1, m + 1):
		facts[n] = facts[n - 1] * n % M
	return facts

def c(n, k):
	f = factorial(n)
	inv_n = pow(f[k], M - 2, M)
	inv_n_k = pow(f[n - k], M - 2, M)
	return f[n] * (inv_n % M) % M * (inv_n_k % M) % M

def main():
	(n, m) = [int(i) for i in input().split()]
	count = count_the_arrays(n, m)
	print(int(count))
main()


MOD = 998244353

def factorial(n):
	prod = 1
	for i in range(1, n + 1):
		prod *= i
		prod %= MOD
	return prod

def fastExp(base, exp):
	if exp == 0:
		return 1
	ans = fastExp(base, exp // 2) ** 2
	if exp % 2 == 1:
		ans *= base
	return ans % MOD

def modularInverse(n):
	return fastExp(n, MOD - 2)

def nChooseK(n, k):
	return factorial(n) * modularInverse(factorial(k)) * modularInverse(factorial(n - k))
(n, m) = [int(i) for i in input().split()]
if n == 2:
	print(0)
else:
	print(nChooseK(m, n - 1) * (n - 2) * fastExp(2, n - 3) % MOD)


p = 998244353

def C(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def po(a, b):
	res = 1
	for i in range(b):
		res *= a
		res %= p
	return res
(n, m) = map(int, input().split())
res = C(m, n - 1)
res *= (n - 2) * po(2, n - 3)
print(int(res % p))


ma = 998244353
(n, m) = map(int, input().split())
fact = [1]
for i in range(1, m + 1):
	fact.append(fact[-1] * i % ma)
ans = fact[m] * pow(fact[n - 1] * fact[m - n + 1], ma - 2, ma) * (n - 2) * pow(2, n - 3, ma) % ma
print(ans)


import sys
input = sys.stdin.readline
(n, m) = list(map(int, input().split()))
mod = 998244353
FACT = [1]
for i in range(1, 2 * 10 ** 5 + 1):
	FACT.append(FACT[-1] * i % mod)
FACT_INV = [pow(FACT[-1], mod - 2, mod)]
for i in range(2 * 10 ** 5, 0, -1):
	FACT_INV.append(FACT_INV[-1] * i % mod)
FACT_INV.reverse()

def Combi(a, b):
	if 0 <= b <= a:
		return FACT[a] * FACT_INV[b] * FACT_INV[a - b] % mod
	else:
		return 0
if n == 2:
	print(0)
else:
	print(Combi(m, n - 1) * (n - 2) * pow(2, n - 3, mod) % mod)


import sys
input = sys.stdin.readline

def main():
	MOD = 998244353
	(N, M) = [int(x) for x in input().split()]
	if N == 2:
		print(0)
		return
	fact = [1, 1]
	factinv = [1, 1]
	inv = [0, 1]

	def cmb(n, k, p):
		if k < 0 or n < k:
			return 0
		r = min(k, n - k)
		return fact[n] * factinv[k] * factinv[n - k] % p
	for i in range(2, 2 * 10 ** 5):
		fact.append(fact[-1] * i % MOD)
		inv.append(-inv[MOD % i] * (MOD // i) % MOD)
		factinv.append(factinv[-1] * inv[-1] % MOD)
	ans = 0
	for i in range(M, -1, -1):
		if i - 1 < N - 2:
			break
		x = cmb(i - 1, N - 2, MOD)
		y = pow(2, N - 3, MOD)
		y = x * y * (N - 2) % MOD
		ans = (ans + y) % MOD
	print(ans)
main()


(n, m) = map(int, input().split())
if n < 3:
	print(0)
	exit(0)
mod = 998244353

def C(n, k):
	if k > n:
		return 0
	k = min(k, n - k)
	a = 1
	b = 1
	for i in range(k):
		a = a * (n - i) % mod
		b = b * (i + 1) % mod
	return a * pow(b, mod - 2, mod) % mod
a = (n - 2) * pow(2, n - 3, mod) % mod
b = (m - n + 2) * C(m, n - 2)
b = b * pow(n - 1, mod - 2, mod) % mod
ans = a * b % mod
print(ans)


import sys
input = sys.stdin.readline
from collections import *
MAX = 2 * 10 ** 5 + 100
MOD = 998244353
fact = [0] * MAX
inv = [0] * MAX
finv = [0] * MAX
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
	fact[i] = fact[i - 1] * i % MOD
	inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
	finv[i] = finv[i - 1] * inv[i] % MOD

def C(n, r):
	if n < r:
		return 0
	if n < 0 or r < 0:
		return 0
	return fact[n] * (finv[r] * finv[n - r] % MOD) % MOD
(n, m) = map(int, input().split())
ans = 0
t = 0
for k in range(1, n - 1):
	t += C(n - 2, k) * k
	t %= MOD
for a in range(n - 1, m + 1):
	ans += C(a - 1, n - 2) * t
	ans %= MOD
print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

def main():
	(n, m) = RL()
	fac = [1, 1]
	for i in range(2, m + 1):
		fac.append(fac[-1] % mod * (i % mod) % mod)

	def cb(m, n):
		return int(fac[m] * pow(fac[n] * fac[m - n], mod - 2, mod)) % mod if m >= n else 0
	res = cb(m, n - 1) * (n - 2) * 2 ** (n - 3)
	print(int(res % mod))
main()


(n, m) = map(int, input().split())
if n == 2:
	print(0)
	exit()
mod = 998244353
ans = (n - 2) * pow(2, n - 3, mod) % mod
for i in range(m - n + 2, m + 1):
	ans = ans * i % mod
fact = 1
for i in range(2, n):
	fact = fact * i % mod
fact = pow(fact, mod - 2, mod)
ans = ans * fact % mod
print(ans)


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

class Mod:

	def __init__(self, m):
		self.m = m

	def add(self, a, b):
		return (a + b) % self.m

	def sub(self, a, b):
		return (a - b) % self.m

	def mul(self, a, b):
		return a % self.m * (b % self.m) % self.m

	def div(self, a, b):
		return self.mul(a, pow(b, self.m - 2, self.m))

	def pow(self, a, b):
		return pow(a, b, self.m)

class Combination:

	def __init__(self, n, mod):
		g1 = [1, 1]
		g2 = [1, 1]
		inverse = [0, 1]
		for i in range(2, n + 1):
			g1.append(g1[-1] * i % mod)
			inverse.append(-inverse[mod % i] * (mod // i) % mod)
			g2.append(g2[-1] * inverse[-1] % mod)
		self.MOD = mod
		self.N = n
		self.g1 = g1
		self.g2 = g2
		self.inverse = inverse

	def __call__(self, n, r):
		if r < 0 or r > n:
			return 0
		r = min(r, n - r)
		return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD

@mt
def slv(N, M):
	if N <= 2:
		return 0
	mod = Mod(998244353)
	C = Combination(2 * 10 ** 5, 998244353)
	ans = 0
	for i in range(1, N - 1):
		ln = i
		rn = N - i - 1
		ln -= 1
		t = C(M, N - 1)
		t = mod.mul(t, C(N - 3, ln))
		t = mod.mul(t, N - 2)
		ans = mod.add(ans, t)
	return ans

def main():
	(N, M) = read_int_n()
	print(slv(N, M))
main()


import sys
from math import *
from collections import defaultdict
from queue import deque
from heapq import heappush, heappop
M = 998244353
invcache = {}
lines = [line.strip() for line in sys.stdin.readlines()]
(n, m) = list(map(int, lines[0].split()))
facts = [1]
pows = [1]
for i in range(1, m + 1):
	facts += [facts[-1] * i % M]
	pows += [pows[-1] * 2 % M]

def gcdext(a, b):
	if a == 0:
		return (b, 0, 1)
	(gcd, x, y) = gcdext(b % a, a)
	return (gcd, y - b // a * x, x)

def modinv(a):
	if a in invcache:
		return invcache[a]
	(g, x, y) = gcdext(a, M)
	assert g == 1
	x %= M
	invcache[a] = x
	return x

def choose(a, b):
	if a < b or b < 0:
		return 0
	if b == 0:
		return 1
	if b == 1:
		return a
	return facts[a] * modinv(facts[b]) % M * modinv(facts[a - b]) % M
ret = 0
for k in range(n - 1, m + 1):
	ret = (ret + choose(k - 1, 1) * choose(k - 2, n - 3) % M * pows[n - 3]) % M
print(ret)


import math
mod = 998244353
fact = [1]
(n, m) = map(int, input().split(' '))
for i in range(1, m + 1):
	fact.append(fact[-1] * i % mod)
ans = (n - 2) * fact[m] * pow(fact[n - 1] * fact[m - n + 1], mod - 2, mod) * pow(2, n - 3, mod)
print(ans % mod)


import math

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
(n, m) = map(int, input().split())
p = 998244353
ans = 0
if n == 2:
	ans = 0
else:
	ans = ncr(m, n - 1, p) % p * ((n - 2) % p) * (pow(2, n - 3, p) % p) % p
print(ans)


import sys
input = sys.stdin.readline

def I():
	return input().strip()

def II():
	return int(input().strip())

def LI():
	return [*map(int, input().strip().split())]
import string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter, OrderedDict
from itertools import permutations, combinations, groupby
from operator import itemgetter
MOD = 998244353

def ncr(nt, r, p):
	num = den = 1
	for i in range(r):
		num = num * (nt - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
for _ in range(1):
	(n, m) = LI()
	if n <= 2:
		print(0)
		continue
	ans = ncr(m, n - 1, MOD) * (n - 2) % MOD
	ans = ans * pow(2, n - 3, MOD) % MOD
	print(ans)


import math
from bisect import bisect_left, bisect_right
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
MOD = 998244353
(n, m) = map(int, input().split())
if n != 2:
	fact = [1]
	for i in range(1, m + 1):
		fact.append(fact[-1] * i % MOD)
	mCn_minus_1 = fact[m] * pow(fact[n - 1] * fact[m - (n - 1)] % MOD, MOD - 2, MOD) % MOD
	print(str(mCn_minus_1 * (n - 2) * pow(2, n - 3, MOD) % MOD) + '\n')
else:
	print('0\n')


from sys import stdin
import math

def binom(n, k):
	return f(n) * modinv(f(k), 998244353) * modinv(f(n - k), 998244353)
(n, m) = map(int, stdin.readline().split())

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a, m):
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m
b = 1
for i in range(n - 3):
	b *= 2
	b = b % 998244353

def f(n):
	n_f = 1
	for i in range(n, 0, -1):
		n_f *= i
		n_f = n_f % 998244353
	return n_f
a = (n - 2) % 998244353
c = binom(m, n - 1) % 998244353
print(a * b * c % 998244353)


M = 998244353
Factorial = [1] * 200001
for i in range(1, 200001):
	Factorial[i] = Factorial[i - 1] * i % M

def nCr(n, m):
	return Factorial[n] * pow(Factorial[m], M - 2, M) * pow(Factorial[n - m], M - 2, M) % M
(n, m) = map(int, input().split())
if n == 2:
	print(0)
else:
	print(nCr(m, n - 1) * (n - 2) % M * pow(2, n - 3, M) % M)


MOD = 998244353
(n, m) = list(map(int, input().split()))

def go(a, b, c):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
			ans %= c
		b //= 2
		a *= a
		a %= c
	return ans
if n == 2:
	print(0)
else:
	start = (n - 2) * go(2, n - 3, MOD)
	start %= MOD
	bunja = 1
	bunmo = 1
	for i in range(n, m + 1):
		bunja *= i
		bunmo *= i - n + 1
		bunja %= MOD
		bunmo %= MOD
	start *= bunja
	temp = go(bunmo, MOD - 2, MOD)
	ans = start * temp
	ans %= MOD
	print(ans)


def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
p = 998244353
(n, m) = map(int, input().split())
print(ncr(m, n - 1, p) * (n - 2) * pow(2, n - 3, p) % p)


def power(x, y, p):
	start = 1
	answer = x
	b = bin(y)[2:]
	for i in range(len(b)):
		d = b[len(b) - 1 - i]
		if d == '1':
			start = start * answer % p
		answer = answer * answer % p
	return start

def binom(x, y, p):
	num = 1
	den = 1
	for i in range(y):
		num = num * (x - i) % p
		den = den * (y - i) % p
	den_inverse = power(den, p - 2, p)
	return num * den_inverse % p

def process(n, m, p=998244353):
	a = binom(m, n - 1, p)
	b = n - 2
	c = power(2, n - 3, p)
	return a * b * c % p
(n, m) = [int(x) for x in input().split()]
print(process(n, m))


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]

def fact(n):
	pro = 1
	for i in range(2, n + 1):
		pro = pro * i % mod
	return pro
(n, m) = li()
if n == 2:
	print(0)
	exit()
a = fact(m)
b = fact(m - n + 1)
c = fact(n - 1)
a = a * inv_mod(b * c % mod) * (n - 2) % mod
a = a * pow(2, n - 3) % mod
print(a)


MOD = 998244353

def C(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD
(n, m) = map(int, input().split())
ans = C(m, n - 1) * (n - 2) * pow(2, n - 3)
print(int(ans % MOD))


from math import *
mod = 998244353
tmp = 0
f = []
fact = 1
f.append(fact)
for i in range(1, 200001):
	fact = fact * i % mod
	f.append(fact)

def power(x, y):
	res = 1
	while y > 0:
		if y % 2:
			res = res * x % mod
		y = y >> 1
		x = x * x % mod
	return res

def ncr(n, r):
	tmp = power(f[r], mod - 2) * f[n] % mod
	tmp = tmp * power(f[n - r], mod - 2) % mod
	return tmp
ans = 0
(n, m) = [int(x) for x in input().split()]
if n == 2:
	print(0)
else:
	for i in range(n - 2, m):
		ans = (ans + ncr(i, n - 2)) % mod
	ans = (n - 2) * ans % mod
	ans = ans * power(2, n - 3) % mod
	print(ans)


import math
MOD = 998244353
(n, m) = map(int, input().split())
fact = [1]
for i in range(1, m + 2):
	fact.append(fact[-1] * i % MOD)
res = (n - 2) * fact[m] * pow(fact[n - 1] * fact[m - (n - 1)], MOD - 2, MOD) * pow(2, n - 3, MOD) % MOD
print(res)


from sys import stdin, stdout
import math
import heapq
t = 1

def aint():
	return int(input().strip())

def lint():
	return list(map(int, input().split()))

def fint():
	return list(map(int, stdin.readline().split()))
fact = [1]
MOD = 998244353
for i in range(1, 200002):
	fact.append(fact[-1] * i % MOD)

def modinv(n):
	return pow(n, MOD - 2, MOD)

def main():
	(n, m) = lint()
	if n == 2:
		print(0)
	else:
		print(fact[m] * modinv(fact[n - 1]) * modinv(fact[m - n + 1]) * pow(2, n - 3, MOD) * (n - 2) % MOD)
t = 1
for i in range(t):
	main()


import sys
mod = 998244353
sys.setrecursionlimit(pow(10, 8))

def power(x, y):
	if y == 0:
		return 1
	elif y == 1:
		return x % mod
	elif y % 2 == 0:
		return power(x, y // 2) ** 2 % mod
	else:
		return power(x, (y - 1) // 2) ** 2 * x % mod

def mul(a, b):
	return a % mod * (b % mod) % mod

def cmb(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
NNN = 2 * 10 ** 5
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, NNN + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)
(N, M) = map(int, input().split())
if N == 2:
	print(0)
else:
	print(mul(mul(cmb(M, N - 1, mod), power(2, N - 3)), N - 2))


(n, m) = map(int, input().split())
p = 998244353

def odw(a):
	cyk = p - 2
	no = a
	wyn = 1
	while cyk > 0:
		if cyk % 2 == 1:
			wyn = wyn * no % p
		no = no * no % p
		cyk //= 2
	return wyn
if n == 2:
	print(0)
else:
	sil = [1] * 200002
	pot = [1] * 200002
	for i in range(1, 200002):
		sil[i] = i * sil[i - 1] % p
		pot[i] = pot[i - 1] * 2 % p
	wyn = 0
	for i in range(n - 1, m + 1):
		try:
			wyn += pot[n - 3] * sil[i - 1] * (n - 2) * odw(sil[n - 2] * sil[i - n + 1])
		except Exception:
			continue
	print(wyn % p)


fc = [1, 1]
MOD = 998244353
for i in range(2, 2 * 10 ** 5 + 3):
	fc.append(fc[-1] * i % MOD)

def slv(n, m):
	if n == 2:
		return 0
	ans = 0
	c = fc[m] * pow(fc[m - n + 1], MOD - 2, MOD) * pow(fc[n - 1], MOD - 2, MOD)
	c %= MOD
	c *= n - 2
	c *= 2 ** (n - 3)
	c %= MOD
	ans += c
	ans %= MOD
	return ans
(n, m) = map(int, input().split())
print(slv(n, m))


class Combination:

	def __init__(self, n, MOD):
		self.fact = [1]
		for i in range(1, n + 1):
			self.fact.append(self.fact[-1] * i % MOD)
		self.inv_fact = [0] * (n + 1)
		self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
		for i in reversed(range(n)):
			self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
		self.MOD = MOD

	def factorial(self, k):
		return self.fact[k]

	def inverse_factorial(self, k):
		return self.inv_fact[k]

	def permutation(self, k, r):
		if k < r:
			return 0
		return self.fact[k] * self.inv_fact[k - r] % self.MOD

	def combination(self, k, r):
		if k < r:
			return 0
		return self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r] % self.MOD
(n, m) = map(int, input().split())
MOD = 998244353
comb = Combination(2 * 10 ** 5 + 10, MOD)
ans = 0
pow_ = pow(2, n - 2, MOD)
for i in range(1, m + 1):
	tmp = comb.combination(i - 1, n - 2)
	tmp *= pow_
	tmp *= n - 2
	ans += tmp
	ans %= MOD
print(ans * pow(2, MOD - 2, MOD) % MOD)


def fast_pow(base, power, modulo):
	if power == 0:
		return 1
	if power % 2 == 1:
		return fast_pow(base, power - 1, modulo) * base % modulo
	else:
		b = fast_pow(base, power // 2, modulo)
		return b * b % modulo

def get_inverse(x, modulo):
	return fast_pow(x, modulo - 2, modulo)
(n, m) = map(int, input().split())
if m < n - 1 or n == 2:
	print(0)
	exit(0)
c = 1
mod = 998244353
sum = 0
for maxx in range(n - 1, m + 1):
	sum += c
	c = c * maxx * get_inverse(maxx - (n - 2), mod) % mod
sum = sum * (n - 2) % mod
for i in range(0, n - 3):
	sum *= 2
	sum = sum % mod
print(sum % mod)


from math import *
import sys, random
MOD = 998244353
fac = [0] * (3 * 10 ** 5 + 5)

def nextInt():
	return int(input())

def nextStrs():
	return input().split()

def nextInts():
	return list(map(int, nextStrs()))

def qpow(b, e):
	global MOD
	if e < 0:
		return 0
	if e == 0:
		return 1
	if e % 2 == 1:
		return b * qpow(b, e - 1) % MOD
	res = qpow(b, e / 2) % MOD
	return res * res % MOD

def inv(a):
	global MOD
	return qpow(a, MOD - 2)

def combo(n, k):
	global MOD, fac
	return fac[n] * inv(fac[n - k] * fac[k]) % MOD

def main():
	global MOD
	fac[0] = 1
	for i in range(1, 3 * (10 ** 5 + 1)):
		fac[i] = fac[i - 1] * i % MOD
	t = 1
	while t > 0:
		(n, m) = nextInts()
		res = combo(m, n - 1) * (n - 2) * qpow(2, n - 3) % MOD
		print(res % MOD)
		t -= 1
exit(main())


def inverse(k, mod):
	return pow(k, mod - 2, mod)

def solve():
	mod = 998244353
	line = input().split(' ')
	n = int(line[0])
	m = int(line[1])
	fact = []
	fact.append(1)
	if n > m:
		k = n + 1
	else:
		k = m + 1
	for i in range(1, k):
		fact.append(0)
		fact[i] = fact[i - 1] * i
		fact[i] = fact[i] % mod
	if n - 1 > m:
		combinaciones = 0
	else:
		combinaciones = fact[m] * inverse(fact[n - 1], mod) * inverse(fact[m - n + 1], mod)
	ans = combinaciones * (n - 2) * pow(2, n - 3, mod)
	ans = ans % mod
	print(int(ans))
solve()


from bisect import *
from math import *
mod = 998244353

def bin_exp(a, n):
	if n == 0:
		return 1
	else:
		j = 0
		bin_val = []
		while n > 0:
			bin_val.append(n % 2)
			n = n // 2
			j += 1
		power_arr = [a % mod]
		for i in range(1, j):
			power_arr.append(power_arr[-1] ** 2 % mod)
		value = 1
		for i in range(0, j):
			if bin_val[i] == 1:
				value = value * power_arr[i] % mod
		return value % mod

def fact_arr(n):
	arr = [1]
	for i in range(n):
		arr.append(arr[-1] * (i + 1) % mod)
	return arr

def mult_inver(a):
	return bin_exp(a, mod - 2)

def fact(a):
	val = 1
	for i in range(2, a + 1):
		val = val * i % mod
	return val
(n, m) = input().split()
n = int(n)
m = int(m)
if n < 3:
	print(0)
else:
	ans = fact(m) * bin_exp(fact(n - 1), mod - 2) * bin_exp(fact(m - (n - 1)), mod - 2) * (n - 2) % mod
	ans = ans * bin_exp(2, n - 3) % mod
	print(ans)


import math
mod = 998244353

def cal_comb(m, n):
	numerator = 1
	denominator = 1
	for i in range(n):
		numerator = numerator * (m - i) % mod
		denominator = denominator * (i + 1) % mod
	return numerator * pow(denominator, mod - 2, mod)
(n, m) = map(int, input().split())
print(cal_comb(m, n - 1) * pow(2, n - 3, mod) % mod * (n - 2) % mod)


import sys, math

def nCr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def ip():
	(n, m) = map(int, input().split())
	ans = 0
	mod = 998244353
	ans = nCr(m, n - 1, mod)
	mul = pow(2, n - 3, mod)
	print(ans * mul % mod * (n - 2) % mod)
ip()


(n, m) = map(int, input().split())
mod = 998244353
bit = [1]
for i in range(1, n - 2):
	bit.append(bit[-1] * 2 % mod)
cn2 = [0 for _ in range(m)]
cn2[n - 2] = 1

def inv(x):
	y = 1
	while x != 1:
		y *= mod // x + 1
		y %= mod
		x -= mod % x
	return y
for i in range(n - 1, m):
	tmp = cn2[i - 1]
	tmp *= i
	tmp %= mod
	tmp *= inv(i - n + 2)
	tmp %= mod
	cn2[i] = tmp
ans = (m - 1) * cn2[-1]
for i in range(n - 2, m - 1):
	ans -= cn2[i]
ans *= bit[-1]
ans %= mod
print(ans)


MOD = 998244353

def pow(base, exp):
	if exp == -1:
		return pow(base, MOD - 2)
	res = 1
	base %= MOD
	while exp > 0:
		if exp % 2:
			res = res * base % MOD
		exp //= 2
		base = base * base % MOD
	res %= MOD
	return res

def main():
	(n, m) = map(int, input().split())
	fact = [0] * (m + 1)
	fact[0] = 1
	for i in range(1, m + 1):
		fact[i] = i * fact[i - 1] % MOD
	ans = fact[m] * pow(2, n - 3) * (n - 2)
	ans %= MOD
	ans = ans * pow(fact[n - 1], MOD - 2)
	ans %= MOD
	ans = ans * pow(fact[m - n + 1], MOD - 2)
	ans %= MOD
	print(ans)
	return
main()


(n, m) = map(int, input().split())
if n == 2:
	print(0)
	exit(0)
MOD = 998244353
fact = [0] * (max(n, m) + 2)
fact[0] = 1
for i in range(1, len(fact)):
	fact[i] = fact[i - 1] * i % MOD

def div(a, b):
	return a * pow(b, MOD - 2, MOD) % MOD

def C(n, k):
	return div(fact[n], fact[n - k] * fact[k] % MOD)
ans = C(m, n - 1) * (n - 2)
num = 0
for i in range(1, n - 1):
	num = (num + C(n - 3, i - 1)) % MOD
print(div(num * ans, 1))


from math import factorial

def factorial(x, mod):
	r = 1
	while x > 1:
		r *= x
		r %= mod
		x -= 1
	return r

def xgcd(a, b):
	if b == 0:
		return (a, 1, 0)
	(gcd, x, y) = xgcd(b, a % b)
	y1 = x - a // b * y
	return (gcd, y, y1)

def inverse(a, mod):
	return xgcd(a, mod)[1]

def solve(n, m, mod):
	result = n - 2
	result %= mod
	if result == 0:
		return 0
	for duplicate in range(n - 3):
		result *= 2
		result %= mod
		if result == 0:
			return 0
	result *= factorial(m, mod)
	result %= mod
	if result == 0:
		return 0
	result *= inverse(factorial(n - 1, mod), mod)
	result %= mod
	if result == 0:
		return 0
	result *= inverse(factorial(m - n + 1, mod), mod)
	result %= mod
	return result
(n, m) = (int(x) for x in input().split(' '))
print(solve(n, m, 998244353))


import math

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
q = 1
for _ in range(q):
	(n, m) = map(int, input().split())
	p = 998244353
	ans = ncr(m, n - 1, p)
	power = 1
	for i in range(n - 3):
		power = power * 2 % p
	ans = ans * power % p
	ans = ans * (n - 2) % p
	print(ans % p)


(n, m) = input().split()
n = int(n)
m = int(m)
mod = 998244353
x1 = x2 = 1
i = m
while i > m - n + 1:
	x1 = x1 * i % mod
	i -= 1
i = 1
while i < n:
	x2 = x2 * i % mod
	i += 1
res = pow(x2, mod - 2, mod)
print(int(res * x1 * pow(2, n - 3, mod) * (n - 2)) % mod)


mod = 998244353

def modinv(x):
	res = 1
	y = mod - 2
	while y:
		if y & 1:
			res = res * x % mod
		x = x * x % mod
		y //= 2
	return res
(n, m) = map(int, input().split())
a = [1]
t = [1]
for i in range(1, m + 1):
	a.append(a[-1] * i % mod)
	t.append(t[-1] * 2 % mod)
num = a[m] * t[n - 2] % mod
den = a[n - 1] * a[m - n + 1] * 2 % mod
num = num * (n - 2) % mod
print(num * modinv(den) % mod)


(n, m) = map(int, input().split())
M = 998244353
f = [1]
for i in range(1, m + 1):
	f.append(f[-1] * i % M)
r = (n - 2) * pow(2, n - 3, M) % M * (f[m] * pow(f[n - 1] * f[m - n + 1] % M, -1, M) % M)
print(r % M)


mod = 998244353
(n, m) = list(map(int, input().split()))
num = 1
for i in range(m, n - 1, -1):
	num = num * i % mod
den = 1
for i in range(1, m - n + 2):
	den = den * i % mod
den = pow(den, mod - 2, mod)
val = pow(2, n - 2, mod)
ans = num * den % mod
ans = ans * (n - 2) % mod
ans = ans * val % mod
t = pow(2, mod - 2, mod)
ans = ans * t % mod
print(ans)


def mod_exp(b, e, mod):
	r = 1
	while e > 0:
		if e & 1 == 1:
			r = r * b % mod
		b = b * b % mod
		e >>= 1
	return r

def fact_exp(n, p):
	e = 0
	u = p
	t = n
	while u <= t:
		e += t // u
		u *= p
	return e

def fermat_binom_advanced(n, k, p):
	num_degree = fact_exp(n, p) - fact_exp(n - k, p)
	den_degree = fact_exp(k, p)
	if num_degree > den_degree:
		return 0
	if k > n:
		return 0
	num = 1
	for i in range(n, n - k, -1):
		cur = i
		while cur % p == 0:
			cur //= p
		num = num * cur % p
	denom = 1
	for i in range(1, k + 1):
		cur = i
		while cur % p == 0:
			cur //= p
		denom = denom * cur % p
	return num * mod_exp(denom, p - 2, p) % p
mod = 998244353
(n, m) = map(int, input().split())
ans = fermat_binom_advanced(m, n - 1, mod)
ans *= n - 2
if n != 2:
	ans *= pow(2, n - 3, mod)
	print(ans % mod)
else:
	print(0)


import math as mt
import sys, string
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def ncr(n, r):
	return mt.factorial(n) // (mt.factorial(n - r) * mt.factorial(r))

def ncr(n, r, mod):
	num = d = 1
	for i in range(r):
		num = num * (n - i) % mod
		d = d * (i + 1) % mod
	return num * pow(d, mod - 2, mod) % mod
(n, m) = M()
ans = ncr(m, n - 1, 998244353) * (n - 2) * pow(2, max(0, n - 3), 998244353)
print(int(ans % 998244353))


import math
mod = 998244353

def cal_comb(m, n):
	num = den = 1
	for i in range(n):
		num = num * (m - i) % mod
		den = den * (i + 1) % mod
	return num * pow(den, mod - 2, mod)
(n, m) = map(int, input().split())
ans = cal_comb(m, n - 1)
print(ans * pow(2, n - 3, mod) % mod * (n - 2) % mod)


from sys import stdin, stdout
int_in = lambda : int(stdin.readline())
arr_in = lambda : [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda : stdin.readline().strip()
out = lambda o: stdout.write('{}\n'.format(o))
arr_out = lambda o: out(' '.join(map(str, o)))
bool_out = lambda o: out('YES' if o else 'NO')

def ncr(n, r, mod):
	num = 1
	den = 1
	for i in range(r):
		num = num * (n - i) % mod
		den = den * (i + 1) % mod
	return num * pow(den, mod - 2, mod) % mod

def solve(n, m):
	mod = 998244353
	result = ncr(m, n - 1, mod)
	result %= mod
	result *= n - 2
	result %= mod
	if n - 3 > 0:
		result *= pow(2, n - 3, mod)
	return result % mod
(n, m) = arr_in()
out(solve(n, m))


import math
MOD = 998244353

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a, m):
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception
	else:
		return x % m

def binomial(n, r):
	res = 1
	down = 1
	for i in range(1, min(r, n - r) + 1):
		res = res * n % MOD
		res = res * modinv(i, MOD) % MOD
		n -= 1
	return res % MOD

def go():
	(n, m) = map(int, input().split())
	if n == 2:
		return 0
	else:
		res = binomial(m, n - 1)
		res = res * (n - 2)
		res = res % MOD
		for i in range(n - 3):
			res = 2 * res % MOD
		return res
print(go())


m = 998244353

def bin_exp(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a *= a % m
		b >>= 1
	return res

def comb(a, b):
	return fac[a] // (fac[b] * fac[a - b])
(n, k) = map(int, input().split())
fac = [1]
for i in range(1, k + 1):
	fac.append(fac[i - 1] * i % m)
print(fac[k] * bin_exp(fac[n - 1] * fac[k - n + 1], m - 2) * (n - 2) * bin_exp(2, n - 3) % m)


M = 998244353
(n, m) = map(int, input().split())
f = [1] * (m + 1)
for i in range(m):
	f[i + 1] = f[i] * (i + 1) % M
cc = 0
if n > 2:
	cc = f[m] * (n - 2) * pow(2, n - 3, M) * pow(f[n - 1] * f[m - n + 1], M - 2, M)
print(cc % M)


M = 998244353
(n, m) = map(int, input().split())
d = [1]
for i in range(m):
	d += (d[-1] * (i + 1) % M,)
print((n - 2) * pow(2, n - 3, M) * d[m] * pow(d[n - 1] * d[m - n + 1], M - 2, M) % M)


import sys
mod = 998244353
fact = [1 for _ in range(200006)]
for i in range(1, 200005):
	fact[i] = fact[i - 1] * i % mod

def modinv(a, mod):
	return pow(a, mod - 2, mod)
(n, m) = map(int, sys.stdin.readline().split())
if n == 2:
	print(0)
else:
	ans = fact[m] * modinv(fact[n - 1], mod) * modinv(fact[m - n + 1], mod) % mod
	ans = ans * (n - 2)
	ans = ans % mod
	ans = ans * pow(2, n - 3, mod) % mod
	print(ans)


MODULO = 998244353
(n, m) = map(int, input().split())
facts = [1 for i in range(m + 1)]
for i in range(1, m + 1):
	facts[i] = i * facts[i - 1] % MODULO
facts_1 = [pow(facts[i], MODULO - 2, MODULO) for i in range(m + 1)]
if n == 2:
	print(0)
else:
	ans = 0
	for summit_value in range(n - 1, m + 1):
		values_variants = facts[summit_value - 1] * facts_1[n - 2] * facts_1[summit_value - 1 - n + 2] * (n - 2) % MODULO
		left_right_variants = pow(2, n - 3, MODULO)
		ans += values_variants * left_right_variants % MODULO
		ans %= MODULO
	print(ans)


import sys
input = sys.stdin.readline
ints = lambda : list(map(int, input().split()))
p = 10 ** 9 + 7
inf = 10 ** 20 + 7
mod = 998244353
fact = [1]
for i in range(1, 3 * 10 ** 5):
	fact.append(fact[-1] * i % mod)

def comb(n, r):
	if n < r:
		return 0
	return fact[n] * pow(fact[r], -1, mod) * pow(fact[n - r], -1, mod) % mod
(n, m) = ints()
ans = 0
for i in range(2, m + 1):
	ans = (ans + comb(i - 1, n - 2)) % mod
ANS = 0
for i in range(1, n - 1):
	ANS = (ANS + ans * comb(n - 3, i - 1)) % mod
print(ANS * (n - 2) % mod)


class FactMod:

	def __init__(self, n, mod):
		self.mod = mod
		self.f = [1] * (n + 1)
		for j in range(1, n + 1):
			self.f[j] = self.f[j - 1] * j % mod
		self.inv = [pow(self.f[-1], mod - 2, mod)]
		for i in range(1, n + 1)[::-1]:
			self.inv.append(self.inv[-1] * i % mod)
		self.inv.reverse()

	def comb(self, n, r):
		ret = self.f[n] * self.inv[n - r] * self.inv[r]
		ret %= self.mod
		return ret
(N, M) = map(int, input().split())
MOD = 998244353
F = FactMod(M, MOD)
if N == 2:
	print(0)
else:
	ans = F.comb(M, N - 1) * (N - 2) * pow(2, N - 3, MOD) % MOD
	print(ans)


def examA():
	T = I()
	ans = []
	for _ in range(T):
		(N, M) = LI()
		if N % M != 0:
			ans.append('NO')
		else:
			ans.append('YES')
	for v in ans:
		print(v)
	return

def examB():
	T = I()
	ans = []
	for _ in range(T):
		N = I()
		A = LI()
		A.sort()
		ans.append(A[::-1])
	for v in ans:
		print(' '.join(map(str, v)))
	return

def examC():
	T = I()
	ans = []
	for _ in range(T):
		(N, K) = LI()
		A = LI()
		sumA = sum(A)
		if sumA == 0:
			ans.append('YES')
			continue
		cur = 0
		L = []
		for i in range(100):
			now = K ** i
			L.append(now)
			cur += now
			if cur >= sumA:
				break
		for i in range(N):
			A[i] *= -1
		heapify(A)
		for l in L[::-1]:
			if not A:
				break
			a = -heappop(A)
			if a < l:
				heappush(A, -a)
			elif a > l:
				heappush(A, -(a - l))
		if not A or heappop(A) == 0:
			ans.append('YES')
		else:
			ans.append('NO')
	for v in ans:
		print(v)
	return

def examD():

	class combination:

		def __init__(self, n, mod):
			self.n = n
			self.fac = [1] * (n + 1)
			self.inv = [1] * (n + 1)
			for j in range(1, n + 1):
				self.fac[j] = self.fac[j - 1] * j % mod
			self.inv[n] = pow(self.fac[n], mod - 2, mod)
			for j in range(n - 1, -1, -1):
				self.inv[j] = self.inv[j + 1] * (j + 1) % mod

		def comb(self, n, r, mod):
			if r > n or n < 0 or r < 0:
				return 0
			return self.fac[n] * self.inv[n - r] * self.inv[r] % mod
	(N, M) = LI()
	ans = 0
	if N == 2:
		print(ans)
		return
	C = combination(M, mod2)
	for i in range(N - 1, M + 1):
		cur = pow(2, N - 3, mod2) * (i - 1) * C.comb(i - 2, N - 3, mod2)
		ans += cur
		ans %= mod2
	print(ans)
	return

def examE():
	ans = 0
	print(ans)
	return

def examF():
	ans = 0
	print(ans)
	return
import sys, copy, bisect, itertools, heapq, math, random
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque

def I():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LSI():
	return list(map(str, sys.stdin.readline().split()))

def LS():
	return sys.stdin.readline().split()

def SI():
	return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet, _ep
mod = 10 ** 9 + 7
mod2 = 998244353
inf = 10 ** 18
_ep = 10 ** (-12)
alphabet = [chr(ord('a') + i) for i in range(26)]
examD()


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def modInt(mod):

	class ModInt:

		def __init__(self, value):
			self.value = value % mod

		def __int__(self):
			return self.value

		def __eq__(self, other):
			return self.value == other.value

		def __hash__(self):
			return hash(self.value)

		def __add__(self, other):
			return ModInt(self.value + int(other))

		def __sub__(self, other):
			return ModInt(self.value - int(other))

		def __mul__(self, other):
			return ModInt(self.value * int(other))

		def __floordiv__(self, other):
			return ModInt(self.value // int(other))

		def __truediv__(self, other):
			return ModInt(self.value * pow(int(other), mod - 2, mod))

		def __str__(self):
			return str(int(self))
	return ModInt

def main():
	(n, m) = map(int, input().split())
	if n == 2:
		print(0)
		return
	ModInt = modInt(998244353)
	factorial = [ModInt(1)]
	for i in range(1, m + 1):
		factorial.append(factorial[-1] * ModInt(i))

	def comb(m, i):
		return factorial[m] / (factorial[i] * factorial[m - i])
	sum = comb(m, n - 1) * (n - 2) * 2 ** (n - 3)
	print(int(sum))
main()


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque
import math

def main():
	mod = 998244353
	(n, m) = map(int, input().split())
	fac = [1]
	invfac = [0]
	if n != 2:
		for i in range(1, m + 1):
			fac.append(fac[-1] * i % mod)
			invfac.append(0)
		invfac[-1] = pow(fac[-1], mod - 2, mod)
		for i in range(m - 1, -1, -1):
			invfac[i] = invfac[i + 1] * (i + 1) % mod
		print(fac[m] * invfac[m - n + 1] * invfac[n - 1] % mod * (n - 2) * pow(2, n - 3, mod) % mod)
	else:
		print(0)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


MOD = 998244353
MAXM = 2 * 10 ** 5
fact = [1] * (MAXM + 1)
for i in range(1, MAXM + 1):
	fact[i] = i * fact[i - 1] % MOD

def inv(a, p):
	res = 1
	p -= 2
	for i in range(32):
		if p % 2:
			res *= a
			res %= MOD
		a = a * a % MOD
		p //= 2
	return res

def C(n, m):
	if m > n:
		return 0
	numerator = fact[n]
	denominator = inv(fact[m] * fact[n - m] % MOD, MOD)
	return numerator * denominator % MOD
(n, m) = map(int, input().split())
ans = 0
for i in range(1, n - 1):
	delta = C(m, n - 1) * C(n - 2, i) % MOD
	delta = delta * i % MOD
	ans += delta
print(ans % MOD)


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
n = 2 * int(100000.0)
mod = 998244353
fact = [1] * (n + 1)
for i in range(1, n + 1):
	fact[i] = fact[i - 1] * i % mod
invfact = [pow(fact[n], mod - 2, mod)]
for i in range(n, 0, -1):
	invfact.append(invfact[-1] * i % mod)
invfact.reverse()

def ncr(n, r):
	return fact[n] * invfact[r] * invfact[n - r] % mod
(n, m) = rinput()
if n == 2:
	print(0)
else:
	print(ncr(m, n - 1) * (n - 2) * pow(2, n - 3, mod) % mod)


import sys
from math import gcd
mod = 998244353
(N, M) = map(int, input().split())

def inv(x, n):
	Q_0 = 0
	R__1 = x
	R_0 = n
	R_1 = 0
	S__1 = 1
	S_0 = 0
	S_1 = 0
	T__1 = 0
	T_0 = 1
	T_1 = 0
	while True:
		Q_0 = R__1 // R_0
		R_1 = R__1 % R_0
		if R_1 == 0:
			break
		S_1 = S__1 - S_0 * Q_0
		T_1 = T__1 - T_0 * Q_0
		(R__1, R_0) = (R_0, R_1)
		(S__1, S_0) = (S_0, S_1)
		(T__1, T_0) = (T_0, T_1)
	return (S_0 + n) % n

def nCr(n, r):
	ret = 1
	for i in range(1, n + 1):
		ret = ret * i % mod
	for i in range(1, r + 1):
		ret = ret * inv(i, mod) % mod
	for i in range(1, n - r + 1):
		ret = ret * inv(i, mod) % mod
	return ret

def f(n, m):
	if n == 2:
		return 0
	ret = n - 2
	ret = ret * pow(2, n - 3, mod) % mod
	ret = ret * nCr(m, n - 1) % mod
	return ret
print(f(N, M))


(n, m) = [int(x) for x in input().split()]
mod = 998244353
f = [1 for i in range(200002)]
for i in range(1, 200002):
	f[i] = f[i - 1] * i % mod

def C(x, y):
	if x >= y and y >= 0:
		ans = f[x] * pow(f[x - y], mod - 2, mod)
		ans %= mod
		return ans * pow(f[y], mod - 2, mod) % mod
	return 0
if n == 2:
	print(0)
else:
	c = C(m, n - 1)
	c = c * (n - 2) * pow(2, n - 3, mod)
	c = c % mod
	print(c)


MOD = 998244353

def modular_inverse(a, m):
	if m == 1:
		return 0
	(m0, x, y) = (m, 1, 0)
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x += m0
	return x

def pow(n):
	if n <= 0:
		return 1
	if n == 1:
		return 2
	x = pow(n // 2) % MOD
	return x * x % MOD if n % 2 == 0 else x * x * 2 % MOD

def solve(n, m):
	if n < 3:
		return 0
	num = (n - 2) * pow(n - 3) % MOD
	for i in range(m, n - 1, -1):
		num = num * i % MOD
	denom = 1
	for i in range(1, m - n + 2):
		denom = denom * i % MOD
	return num * modular_inverse(denom, MOD) % MOD

def main():
	from sys import stdin
	(n, m) = list(map(int, stdin.readline().strip().split()))
	print(solve(n, m))
main()


import sys

def c(n1, k1, mod1):
	num = den = 1
	for i in range(n1 - k1):
		num = num * (n1 - i) % mod1
		den = den * (i + 1) % mod1
	return num * pow(den, mod1 - 2, mod1) % mod1

def solve_of_problem():
	(n, m) = [int(x) for x in sys.stdin.readline().strip().split()]
	if n == 2:
		print(0)
	else:
		print(c(m, n - 1, mod) * ((n - 2) % mod) * pow(2, n - 3, mod) % mod)
	return
mod = 998244353
solve_of_problem()


mod = 998244353
(n, m) = map(int, input().split())
fac = [1]
invfac = [0]
if n != 2:
	for i in range(1, m + 1):
		fac.append(fac[-1] * i % mod)
		invfac.append(0)
	invfac[-1] = pow(fac[-1], mod - 2, mod)
	for i in range(m - 1, -1, -1):
		invfac[i] = invfac[i + 1] * (i + 1) % mod
	print(fac[m] * invfac[m - n + 1] * invfac[n - 1] % mod * (n - 2) * pow(2, n - 3, mod) % mod)
else:
	print(0)


import math

def powerMo(a, n, mo):
	ans = 1
	posi = a
	while n > 0:
		if n & 1:
			ans *= posi
			ans %= mo
		n >>= 1
		posi = posi * posi % mo
	return ans

def modInv(a, mo):
	phi = mo - 1
	return powerMo(a, phi - 1, mo)

def combMo(n, a, mo):
	numer = 1
	for i in range(n - a + 1, n + 1):
		numer *= i
		numer %= mo
	denom = 1
	for i in range(1, a + 1):
		denom *= i
		denom %= mo
	denomInv = modInv(denom, mo)
	ans = numer * denomInv % mo
	return ans

def f():
	mo = 998244353
	(n, m) = [int(s) for s in input().split()]
	if n == 2:
		print(0)
		return
	c = combMo(m, n - 1, mo)
	c *= n - 2
	a = powerMo(2, n - 3, mo)
	res = a * c % mo
	print(res)
f()


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
mod = 998244353

def euclidean(x, y):
	stk = []
	while y:
		stk.append(x // y)
		(x, y) = (y, x % y)
	stk.pop()
	(a, b) = (0, 1)
	for i in stk[::-1]:
		(a, b) = (b, a - i * b)
	return (x, a, b)

def comb(n, k, mod):
	k = min(k, n - k)
	if k == 0:
		return 1
	(top, bot) = (n, 1)
	for i in range(1, k):
		bot = bot * (i + 1) % mod
		top = top * (n - i) % mod
	(_, inv, _) = euclidean(bot, mod)
	return top * inv % mod
if n == 2:
	ans = 0
else:
	ans = comb(m, n - 1, mod) * (n - 2) * pow(2, n - 3, mod) % mod
print(ans)


from sys import stdin
mod = 998244353
fact = [1, 1]
for i in range(2, 200001):
	fact.append(fact[i - 1] * i % mod)

def ncr(n, r):
	m = pow(fact[r] * fact[n - r], mod - 2, mod)
	return fact[n] * m % mod
(n, m) = map(int, stdin.readline().split())
if n > 2:
	ans = ncr(m, n - 1) * (n - 2) * pow(2, n - 3, mod)
	print(ans % mod)
else:
	print(0)


(n, m) = map(int, input().split())
mod = 998244353
n_max = 2 * (10 ** 5 + 1)
(F, FI) = ([0] * (n_max + 1), [0] * (n_max + 1))
(F[0], FI[0]) = (1, 1)
for i in range(n_max):
	F[i + 1] = F[i] * (i + 1) % mod
FI[n_max - 1] = pow(F[n_max - 1], mod - 2, mod)
for i in reversed(range(n_max - 1)):
	FI[i] = FI[i + 1] * (i + 1) % mod

def comb(x, y):
	return F[x] * FI[x - y] * FI[y] % mod
print(comb(m, n - 1) * (n - 2) * pow(2, n - 3, mod) % mod)


def divisors(M):
	d = []
	i = 1
	while M >= i ** 2:
		if M % i == 0:
			d.append(i)
			if i ** 2 != M:
				d.append(M // i)
		i = i + 1
	return d

def popcount(x):
	x = x - (x >> 1 & 1431655765)
	x = (x & 858993459) + (x >> 2 & 858993459)
	x = x + (x >> 4) & 252645135
	x = x + (x >> 8)
	x = x + (x >> 16)
	return x & 127

def eratosthenes(n):
	res = [0 for i in range(n + 1)]
	prime = set([])
	for i in range(2, n + 1):
		if not res[i]:
			prime.add(i)
			for j in range(1, n // i + 1):
				res[i * j] = 1
	return prime

def factorization(n):
	res = []
	for p in prime:
		if n % p == 0:
			while n % p == 0:
				n //= p
			res.append(p)
	if n != 1:
		res.append(n)
	return res

def euler_phi(n):
	res = n
	for x in range(2, n + 1):
		if x ** 2 > n:
			break
		if n % x == 0:
			res = res // x * (x - 1)
			while n % x == 0:
				n //= x
	if n != 1:
		res = res // n * (n - 1)
	return res

def ind(b, n):
	res = 0
	while n % b == 0:
		res += 1
		n //= b
	return res

def isPrimeMR(n):
	if n == 1:
		return 0
	d = n - 1
	d = d // (d & -d)
	L = [2, 3, 5, 7, 11, 13, 17]
	for a in L:
		t = d
		y = pow(a, t, n)
		if y == 1:
			continue
		while y != n - 1:
			y = y * y % n
			if y == 1 or t == n - 1:
				return 0
			t <<= 1
	return 1

def findFactorRho(n):
	from math import gcd
	m = 1 << n.bit_length() // 8
	for c in range(1, 99):
		f = lambda x: (x * x + c) % n
		(y, r, q, g) = (2, 1, 1, 1)
		while g == 1:
			x = y
			for i in range(r):
				y = f(y)
			k = 0
			while k < r and g == 1:
				ys = y
				for i in range(min(m, r - k)):
					y = f(y)
					q = q * abs(x - y) % n
				g = gcd(q, n)
				k += m
			r <<= 1
		if g == n:
			g = 1
			while g == 1:
				ys = f(ys)
				g = gcd(abs(x - ys), n)
		if g < n:
			if isPrimeMR(g):
				return g
			elif isPrimeMR(n // g):
				return n // g
			return findFactorRho(g)

def primeFactor(n):
	i = 2
	ret = {}
	rhoFlg = 0
	while i * i <= n:
		k = 0
		while n % i == 0:
			n //= i
			k += 1
		if k:
			ret[i] = k
		i += 1 + i % 2
		if i == 101 and n >= 2 ** 20:
			while n > 1:
				if isPrimeMR(n):
					(ret[n], n) = (1, 1)
				else:
					rhoFlg = 1
					j = findFactorRho(n)
					k = 0
					while n % j == 0:
						n //= j
						k += 1
					ret[j] = k
	if n > 1:
		ret[n] = 1
	if rhoFlg:
		ret = {x: ret[x] for x in sorted(ret)}
	return ret

def divisors(n):
	res = [1]
	prime = primeFactor(n)
	for p in prime:
		newres = []
		for d in res:
			for j in range(prime[p] + 1):
				newres.append(d * p ** j)
		res = newres
	res.sort()
	return res

def xorfactorial(num):
	if num == 0:
		return 0
	elif num == 1:
		return 1
	elif num == 2:
		return 3
	elif num == 3:
		return 0
	else:
		x = baseorder(num)
		return 2 ** x * ((num - 2 ** x + 1) % 2) + function(num - 2 ** x)

def xorconv(n, X, Y):
	if n == 0:
		res = [X[0] * Y[0] % mod]
		return res
	x = [digit[i] + X[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	y = [Y[i] + Y[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	z = [digit[i] - X[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	w = [Y[i] - Y[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	res1 = xorconv(n - 1, x, y)
	res2 = xorconv(n - 1, z, w)
	former = [(res1[i] + res2[i]) * inv for i in range(2 ** (n - 1))]
	latter = [(res1[i] - res2[i]) * inv for i in range(2 ** (n - 1))]
	former = list(map(lambda x: x % mod, former))
	latter = list(map(lambda x: x % mod, latter))
	return former + latter

def merge_sort(A, B):
	(pos_A, pos_B) = (0, 0)
	(n, m) = (len(A), len(B))
	res = []
	while pos_A < n and pos_B < m:
		(a, b) = (A[pos_A], B[pos_B])
		if a < b:
			res.append(a)
			pos_A += 1
		else:
			res.append(b)
			pos_B += 1
	res += A[pos_A:]
	res += B[pos_B:]
	return res

class UnionFindVerSize:

	def __init__(self, N):
		self._parent = [n for n in range(0, N)]
		self._size = [1] * N
		self.group = N

	def find_root(self, x):
		if self._parent[x] == x:
			return x
		self._parent[x] = self.find_root(self._parent[x])
		stack = [x]
		while self._parent[stack[-1]] != stack[-1]:
			stack.append(self._parent[stack[-1]])
		for v in stack:
			self._parent[v] = stack[-1]
		return self._parent[x]

	def unite(self, x, y):
		gx = self.find_root(x)
		gy = self.find_root(y)
		if gx == gy:
			return
		self.group -= 1
		if self._size[gx] < self._size[gy]:
			self._parent[gx] = gy
			self._size[gy] += self._size[gx]
		else:
			self._parent[gy] = gx
			self._size[gx] += self._size[gy]

	def get_size(self, x):
		return self._size[self.find_root(x)]

	def is_same_group(self, x, y):
		return self.find_root(x) == self.find_root(y)

class WeightedUnionFind:

	def __init__(self, N):
		self.parent = [i for i in range(N)]
		self.size = [1 for i in range(N)]
		self.val = [0 for i in range(N)]
		self.flag = True
		self.edge = [[] for i in range(N)]

	def dfs(self, v, pv):
		stack = [(v, pv)]
		new_parent = self.parent[pv]
		while stack:
			(v, pv) = stack.pop()
			self.parent[v] = new_parent
			for (nv, w) in self.edge[v]:
				if nv != pv:
					self.val[nv] = self.val[v] + w
					stack.append((nv, v))

	def unite(self, x, y, w):
		if not self.flag:
			return
		if self.parent[x] == self.parent[y]:
			self.flag = self.val[x] - self.val[y] == w
			return
		if self.size[self.parent[x]] > self.size[self.parent[y]]:
			self.edge[x].append((y, -w))
			self.edge[y].append((x, w))
			self.size[x] += self.size[y]
			self.val[y] = self.val[x] - w
			self.dfs(y, x)
		else:
			self.edge[x].append((y, -w))
			self.edge[y].append((x, w))
			self.size[y] += self.size[x]
			self.val[x] = self.val[y] + w
			self.dfs(x, y)

class Dijkstra:

	class Edge:

		def __init__(self, _to, _cost):
			self.to = _to
			self.cost = _cost

	def __init__(self, V):
		self.G = [[] for i in range(V)]
		self._E = 0
		self._V = V

	@property
	def E(self):
		return self._E

	@property
	def V(self):
		return self._V

	def add_edge(self, _from, _to, _cost):
		self.G[_from].append(self.Edge(_to, _cost))
		self._E += 1

	def shortest_path(self, s):
		import heapq
		que = []
		d = [10 ** 15] * self.V
		d[s] = 0
		heapq.heappush(que, (0, s))
		while len(que) != 0:
			(cost, v) = heapq.heappop(que)
			if d[v] < cost:
				continue
			for i in range(len(self.G[v])):
				e = self.G[v][i]
				if d[e.to] > d[v] + e.cost:
					d[e.to] = d[v] + e.cost
					heapq.heappush(que, (d[e.to], e.to))
		return d

def Z_algorithm(s):
	N = len(s)
	Z_alg = [0] * N
	Z_alg[0] = N
	i = 1
	j = 0
	while i < N:
		while i + j < N and s[j] == s[i + j]:
			j += 1
		Z_alg[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < N and k + Z_alg[k] < j:
			Z_alg[i + k] = Z_alg[k]
			k += 1
		i += k
		j -= k
	return Z_alg

class BIT:

	def __init__(self, n, mod=0):
		self.BIT = [0] * (n + 1)
		self.num = n
		self.mod = mod

	def query(self, idx):
		res_sum = 0
		mod = self.mod
		while idx > 0:
			res_sum += self.BIT[idx]
			if mod:
				res_sum %= mod
			idx -= idx & -idx
		return res_sum

	def update(self, idx, x):
		mod = self.mod
		while idx <= self.num:
			self.BIT[idx] += x
			if mod:
				self.BIT[idx] %= mod
			idx += idx & -idx
		return

class dancinglink:

	def __init__(self, n, debug=False):
		self.n = n
		self.debug = debug
		self._left = [i - 1 for i in range(n)]
		self._right = [i + 1 for i in range(n)]
		self.exist = [True for i in range(n)]

	def pop(self, k):
		if self.debug:
			assert self.exist[k]
		L = self._left[k]
		R = self._right[k]
		if L != -1:
			if R != self.n:
				(self._right[L], self._left[R]) = (R, L)
			else:
				self._right[L] = self.n
		elif R != self.n:
			self._left[R] = -1
		self.exist[k] = False

	def left(self, idx, k=1):
		if self.debug:
			assert self.exist[idx]
		res = idx
		while k:
			res = self._left[res]
			if res == -1:
				break
			k -= 1
		return res

	def right(self, idx, k=1):
		if self.debug:
			assert self.exist[idx]
		res = idx
		while k:
			res = self._right[res]
			if res == self.n:
				break
			k -= 1
		return res

class SparseTable:

	def __init__(self, A, merge_func, ide_ele):
		N = len(A)
		n = N.bit_length()
		self.table = [[ide_ele for i in range(n)] for i in range(N)]
		self.merge_func = merge_func
		for i in range(N):
			self.table[i][0] = A[i]
		for j in range(1, n):
			for i in range(0, N - 2 ** j + 1):
				f = self.table[i][j - 1]
				s = self.table[i + 2 ** (j - 1)][j - 1]
				self.table[i][j] = self.merge_func(f, s)

	def query(self, s, t):
		b = t - s + 1
		m = b.bit_length() - 1
		return self.merge_func(self.table[s][m], self.table[t - 2 ** m + 1][m])

class BinaryTrie:

	class node:

		def __init__(self, val):
			self.left = None
			self.right = None
			self.max = val

	def __init__(self):
		self.root = self.node(-10 ** 15)

	def append(self, key, val):
		pos = self.root
		for i in range(29, -1, -1):
			pos.max = max(pos.max, val)
			if key >> i & 1:
				if pos.right is None:
					pos.right = self.node(val)
					pos = pos.right
				else:
					pos = pos.right
			elif pos.left is None:
				pos.left = self.node(val)
				pos = pos.left
			else:
				pos = pos.left
		pos.max = max(pos.max, val)

	def search(self, M, xor):
		res = -10 ** 15
		pos = self.root
		for i in range(29, -1, -1):
			if pos is None:
				break
			if M >> i & 1:
				if xor >> i & 1:
					if pos.right:
						res = max(res, pos.right.max)
					pos = pos.left
				else:
					if pos.left:
						res = max(res, pos.left.max)
					pos = pos.right
			elif xor >> i & 1:
				pos = pos.right
			else:
				pos = pos.left
		if pos:
			res = max(res, pos.max)
		return res

def solveequation(edge, ans, n, m):
	x = [0] * m
	used = [False] * n
	for v in range(n):
		if used[v]:
			continue
		y = dfs(v)
		if y != 0:
			return False
	return x

	def dfs(v):
		used[v] = True
		r = ans[v]
		for (to, dire, id) in edge[v]:
			if used[to]:
				continue
			y = dfs(to)
			if dire == -1:
				x[id] = y
			else:
				x[id] = -y
			r += y
		return r

class Matrix:
	mod = 10 ** 9 + 7

	def set_mod(m):
		Matrix.mod = m

	def __init__(self, L):
		self.row = len(L)
		self.column = len(L[0])
		self._matrix = L
		for i in range(self.row):
			for j in range(self.column):
				self._matridigit[i][j] %= Matrix.mod

	def __getitem__(self, item):
		if type(item) == int:
			raise IndexError('you must specific row and column')
		elif len(item) != 2:
			raise IndexError('you must specific row and column')
		(i, j) = item
		return self._matridigit[i][j]

	def __setitem__(self, item, val):
		if type(item) == int:
			raise IndexError('you must specific row and column')
		elif len(item) != 2:
			raise IndexError('you must specific row and column')
		(i, j) = item
		self._matridigit[i][j] = val

	def __add__(self, other):
		if (self.row, self.column) != (other.row, other.column):
			raise SizeError('sizes of matrixes are different')
		res = [[0 for j in range(self.column)] for i in range(self.row)]
		for i in range(self.row):
			for j in range(self.column):
				res[i][j] = self._matridigit[i][j] + other._matridigit[i][j]
				res[i][j] %= Matrix.mod
		return Matrix(res)

	def __sub__(self, other):
		if (self.row, self.column) != (other.row, other.column):
			raise SizeError('sizes of matrixes are different')
		res = [[0 for j in range(self.column)] for i in range(self.row)]
		for i in range(self.row):
			for j in range(self.column):
				res[i][j] = self._matridigit[i][j] - other._matridigit[i][j]
				res[i][j] %= Matrix.mod
		return Matrix(res)

	def __mul__(self, other):
		if type(other) != int:
			if self.column != other.row:
				raise SizeError('sizes of matrixes are different')
			res = [[0 for j in range(other.column)] for i in range(self.row)]
			for i in range(self.row):
				for j in range(other.column):
					temp = 0
					for k in range(self.column):
						temp += self._matridigit[i][k] * other._matrix[k][j]
					res[i][j] = temp % Matrix.mod
			return Matrix(res)
		else:
			n = other
			res = [[n * self._matridigit[i][j] % Matrix.mod for j in range(self.column)] for i in range(self.row)]
			return Matrix(res)

	def __pow__(self, m):
		if self.column != self.row:
			raise MatrixPowError('the size of row must be the same as that of column')
		n = self.row
		res = Matrix([[int(i == j) for i in range(n)] for j in range(n)])
		while m:
			if m % 2 == 1:
				res = res * self
			self = self * self
			m //= 2
		return res

	def __str__(self):
		res = []
		for i in range(self.row):
			for j in range(self.column):
				res.append(str(self._matridigit[i][j]))
				res.append(' ')
			res.append('\n')
		res = res[:len(res) - 1]
		return ''.join(res)
from collections import deque

class Dinic:

	def __init__(self, N):
		self.N = N
		self.G = [[] for i in range(N)]

	def add_edge(self, fr, to, cap):
		forward = [to, cap, None]
		forward[2] = backward = [fr, 0, forward]
		self.G[fr].append(forward)
		self.G[to].append(backward)

	def add_multi_edge(self, v1, v2, cap1, cap2):
		edge1 = [v2, cap1, None]
		edge1[2] = edge2 = [v1, cap2, edge1]
		self.G[v1].append(edge1)
		self.G[v2].append(edge2)

	def bfs(self, s, t):
		self.level = level = [None] * self.N
		deq = deque([s])
		level[s] = 0
		G = self.G
		while deq:
			v = deq.popleft()
			lv = level[v] + 1
			for (w, cap, _) in G[v]:
				if cap and level[w] is None:
					level[w] = lv
					deq.append(w)
		return level[t] is not None

	def dfs(self, v, t, f):
		if v == t:
			return f
		level = self.level
		for e in self.it[v]:
			(w, cap, rev) = e
			if cap and level[v] < level[w]:
				d = self.dfs(w, t, min(f, cap))
				if d:
					e[1] -= d
					rev[1] += d
					return d
		return 0

	def flow(self, s, t):
		flow = 0
		INF = 10 ** 9 + 7
		G = self.G
		while self.bfs(s, t):
			(*self.it,) = map(iter, self.G)
			f = INF
			while f:
				f = self.dfs(s, t, INF)
				flow += f
		return flow

def cmb(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] % mod * g2[n - r] % mod
mod = 998244353
N = 2 * 10 ** 5 + 100
g1 = [1] * (N + 1)
g2 = [1] * (N + 1)
inverse = [1] * (N + 1)
for i in range(2, N + 1):
	g1[i] = g1[i - 1] * i % mod
	inverse[i] = -inverse[mod % i] * (mod // i) % mod
	g2[i] = g2[i - 1] * inverse[i] % mod
inverse[0] = 0
import sys, random, bisect
from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations
from math import gcd, log
input = lambda : sys.stdin.readline().rstrip()
mi = lambda : map(int, input().split())
li = lambda : list(mi())
mod = 998244353
(n, m) = mi()
if n >= 3:
	res = cmb(m, n - 1, mod) * pow(2, n - 3, mod) * (n - 2) % mod
else:
	res = 0
print(res)


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())
mod = 998244353

def fac(x):
	f = 1
	for i in range(2, x + 1):
		f = f * i % mod
	return f
(n, m) = mdata()
ans = fac(m) * (n - 2) * pow(2, n - 3, mod) * pow(fac(n - 1), mod - 2, mod) * pow(fac(m - n + 1), mod - 2, mod)
print(ans % mod)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
(n, m) = mp()
if n == 2:
	print(0)
else:
	print(ncr(m, n - 1, mod2) * pow(2, n - 3, mod2) * (n - 2) % mod2)


mod = 998244353

def pow(a, b):
	if b == 0:
		return 1
	if b % 2 == 0:
		k = pow(a, b // 2)
		return k * k % mod
	else:
		return pow(a, b - 1) * a % mod

def fact(x):
	k = 1
	for i in range(1, x + 1):
		k *= i
		k %= mod
	return k
(n, m) = map(int, input().split())
answer = (n - 2) % mod
if n >= 3:
	answer *= pow(2, n - 3) % mod
mf = fact(m)
nf = fact(n - 1)
df = fact(m - n + 1)
mf *= pow(df, mod - 2)
mf %= mod
mf *= pow(nf, mod - 2)
mf %= mod
answer *= mf % mod
print(answer % mod)


MOD = 998244353

def add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mul(x, y):
	return x * y % MOD

def binpow(x, y):
	z = 1
	while y:
		if y & 1:
			z = mul(z, x)
		x = mul(x, x)
		y >>= 1
	return z

def inv(x):
	return binpow(x, MOD - 2)

def divide(x, y):
	return mul(x, inv(y))
fact = []
N = 200000

def precalc():
	fact.append(1)
	for i in range(N):
		fact.append(mul(fact[i], i + 1))

def C(n, k):
	return divide(fact[n], mul(fact[k], fact[n - k]))
precalc()
NM = input()
[N, M] = NM.split()
N = int(N)
M = int(M)
res = 0
if N > 2:
	res = mul(C(M, N - 1), mul(N - 2, binpow(2, N - 3)))
print(res)


import io
import os

def solve(N, M):
	MOD = 998244353

	def modInverse(a, p):
		return pow(a, p - 2, p)
	fact = [1]
	for i in range(1, M + 1):
		fact.append(fact[-1] * i % MOD)

	def nCr(n, r, p=MOD):
		return fact[n] * modInverse(fact[r], p) * modInverse(fact[n - r], p) % p
	if N <= 3:
		power = 1
	else:
		power = pow(2, N - 3, MOD)
	ans = nCr(M, N - 1, MOD) * (N - 2) * power
	return ans % MOD
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(N, M) = list(map(int, input().split()))
ans = solve(N, M)
print(ans)


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
mod = 998244353
a = b = 1
for i in range(min(m, m - (n - 1))):
	a = a * (m - i) % mod
	b = b * (i + 1) % mod
ans = a * pow(b, mod - 2, mod) % mod
for i in range(n - 3):
	ans = ans * 2 % mod
print(ans * (n - 2) % mod)


(n, m) = map(int, input().split())
p = 998244353

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x
binom_cache = {}
mod_fact = [1] * (max(n, m) + 1)
for i in range(1, max(n, m) + 1):
	mod_fact[i] = mod_fact[i - 1] * i % p
pow2 = [1] * 200001
for i in range(1, 200000 + 1):
	pow2[i] = pow2[i - 1] * 2 % p

def binom(n, k, cache):
	if k > n - k:
		k = n - k
	if (n, k) not in cache:
		cache[n, k] = mod_fact[n] * modInverse(mod_fact[k], p) * modInverse(mod_fact[n - k], p) % p
	return cache[n, k]
if n > m + 1 or n == 2:
	print(0)
else:
	grand = binom(m, n - 1, binom_cache)
	cnt = pow2[n - 3] * (n - 2)
	print(grand * cnt % p)


import sys
input = sys.stdin.readline
MOD = 998244353
MAX_N = 2 * 10 ** 5 + 1
(n, m) = map(int, input().split())
fac = [1] + [0] * MAX_N
for i in range(1, MAX_N + 1):
	fac[i] = fac[i - 1] * i % MOD
fac_inv = [1] + [0] * MAX_N
fac_inv[MAX_N] = pow(fac[MAX_N], MOD - 2, MOD)
for i in range(MAX_N, 1, -1):
	fac_inv[i - 1] = fac_inv[i] * i % MOD

def mod_nCr(n, r):
	if n < r or n < 0 or r < 0:
		return 0
	tmp = fac_inv[n - r] * fac_inv[r] % MOD
	return tmp * fac[n] % MOD
if n - 3 > 0:
	ans = mod_nCr(m, n - 1) * (n - 2) * pow(2, n - 3, MOD)
else:
	ans = mod_nCr(m, n - 1) * (n - 2)
ans %= MOD
print(ans)


MOD = 998244353

def inv_mod(k):
	return pow(k, MOD - 2, MOD)

def comb(n, k):
	return fact[n] * inv_mod(fact[k]) % MOD * inv_mod(fact[n - k]) % MOD
(n, m) = map(int, input().split())
fact = []
fact.append(1)
for i in range(1, m + 1):
	fact.append(fact[i - 1] * i % MOD)
ans = 0
if n > 2:
	ans = (n - 2) * comb(m, n - 1) % MOD * pow(2, n - 3, MOD) % MOD
print(ans)


import sys
input = sys.stdin.readline
(fact, inv_fact) = ([0] * (2 * 10 ** 5 + 1), [0] * (2 * 10 ** 5 + 1))
fact[0] = 1
mod = 998244353

def make_nCr_mod(max_n=2 * 10 ** 5, mod=998244353):
	global fact
	global inv_fact
	for i in range(max_n):
		fact[i + 1] = fact[i] * (i + 1) % mod
	inv_fact[-1] = pow(fact[-1], mod - 2, mod)
	for i in reversed(range(max_n)):
		inv_fact[i] = inv_fact[i + 1] * (i + 1) % mod
make_nCr_mod()

def nCr_mod(n, r):
	res = 1
	while n or r:
		(a, b) = (n % mod, r % mod)
		if a < b:
			return 0
		res = res * fact[a] % mod * inv_fact[b] % mod * inv_fact[a - b] % mod
		n //= mod
		r //= mod
	return res
(n, m) = map(int, input().split())
if n == 2:
	print(0)
else:
	print(nCr_mod(m, n - 1) * (n - 2) * pow(2, n - 3, mod) % mod)


import sys
input = sys.stdin.readline
modi = 998244353

def mod(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x

def fact(n):
	s = 1
	if n == 0:
		return s
	for i in range(1, n + 1):
		s = s * i % modi
	return s
(m, n) = map(int, input().split())
s = fact(n)
p = fact(m - 1) * fact(n - m + 1) % modi
s = s * mod(p, modi) % modi
s = s * (m - 2) * pow(2, max(m - 3, 0), modi) % modi
print(s)


def modfac(n, MOD):
	f = 1
	factorials = [1]
	for m in range(1, n + 1):
		f *= m
		f %= MOD
		factorials.append(f)
	inv = pow(f, MOD - 2, MOD)
	invs = [1] * (n + 1)
	invs[n] = inv
	for m in range(n, 1, -1):
		inv *= m
		inv %= MOD
		invs[m - 1] = inv
	return (factorials, invs)

def modnCr(n, r, mod, fac, inv):
	return fac[n] * inv[n - r] * inv[r] % mod
import sys
(n, m) = map(int, input().split())
if n == 2:
	print(0)
	sys.exit()
mod = 998244353
(fac, inv) = modfac(300000, mod)
ans = 0
np = pow(2, n - 3, mod)
for mid in range(n - 1, m + 1):
	now = (mid - 1) * modnCr(mid - 2, n - 3, mod, fac, inv) * np % mod
	ans += now
	ans %= mod
print(ans)


MOD = 998244353
fak = []
fak.append(1)
for i in range(200005):
	fak.append(fak[-1] * (i + 1) % MOD)

def brzo(x, y):
	if not y:
		return 1
	if y % 2:
		return brzo(x, y - 1) * x % MOD
	k = brzo(x, y // 2)
	return k * k % MOD

def inv(x):
	return brzo(x, MOD - 2)
(n, m) = map(int, input().split())
if n <= 2:
	print(0)
else:
	print(fak[m] * inv(fak[n - 1] * fak[m - n + 1]) * (n - 2) * (1 << n - 3) % MOD)


import math
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
(n, m) = list(map(int, input().split()))
mod = 998244353

def power(base, e):
	res = 1
	while e:
		if e % 2 == 1:
			res = res * base % mod
		base = base * base % mod
		e //= 2
	return res
if n == 2:
	print(0)
else:
	ans = 1 * (n - 2) * power(2, n - 3) % mod
	for i in range(1, n):
		ans = ans * (m - i + 1) % mod * power(i, mod - 2) % mod
	print(ans)


MOD = 998244353

def pow_mod(n, k, mod):
	if k == 0:
		return 1
	if k % 2 == 1:
		return n * pow_mod(n, k - 1, mod) % mod
	else:
		r = pow_mod(n, k // 2, mod)
		return r * r % mod

def mod_inverse(n, mod):
	return pow_mod(n, mod - 2, mod)

def fact_mod(n, mod):
	res = 1
	for i in range(2, n + 1):
		res = res * i % mod
	return res

def choose_mod(n, k, mod):
	return fact_mod(n, mod) * mod_inverse(fact_mod(k, mod), mod) * mod_inverse(fact_mod(n - k, mod), mod) % mod
(n, m) = map(int, input().split())
if n == 2:
	print(0)
else:
	res = choose_mod(m, n - 1, MOD) * ((n - 2) % MOD) * pow_mod(2, n - 3, MOD)
	print(res % MOD)


(n, m) = map(int, input().split())
if n == 2:
	print(0)
else:
	(C, ans) = (998244353, 0)
	(fact, pow1) = ([1], pow(2, n - 3, C))
	for q in range(1, m + 1):
		fact.append(fact[-1] * q % C)
	for q in range(n - 1, m + 1):
		ans += fact[q - 1] * pow(fact[n - 2], C - 2, C) * pow(fact[q - n + 1], C - 2, C) * (n - 2) * pow1
	print(ans % C)


arr = [1, 1]
v = 998244353
for i in range(2, 2 * pow(10, 5) + 1):
	arr.append(arr[-1] * i % v)
inp = list(map(int, input().split()))
n = inp[0]
m = inp[1]
ans = 0
if n == 2:
	print(0)
else:
	x = int(pow(2, n - 3, v) * (n - 2))
	k = n - 1
	y = pow(arr[n - 2], v - 2, v)
	while k <= m:
		z = pow(arr[k - n + 1], v - 2, v)
		ans += arr[k - 1] * z * y % v
		k += 1
	print(ans * x % v)


import sys
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
mod = 998244353

def power(a, b):
	val = 1
	while b > 0:
		if b % 2 == 1:
			val = val * a % mod
		b = b // 2
		a = a * a % mod
	return val
(n, m) = read()
fact = [1]
for i in range(1, m + 1):
	fact.append(fact[i - 1] * i % mod)
ans = power(2, n - 3)
ans = ans * (n - 2) % mod
res = fact[m] * power(fact[n - 1], mod - 2)
res = res * power(fact[m - n + 1], mod - 2) % mod
ans = ans * res % mod
print(ans)


def mod_inverse(x, mod):
	return pow(x, mod - 2, mod)

def mod_comb(n, k, mod):
	(numer, denom) = (1, 1)
	for i in range(k):
		numer = numer * ((n - i) % mod) % mod
		denom = denom * ((i + 1) % mod) % mod
	return numer * mod_inverse(denom, mod) % mod
(n, m) = map(int, input().split())
mod = 998244353
ans = mod_comb(m, n - 1, mod)
ans = ans * (n - 2) % mod
ans = ans * pow(2, n - 3, mod) % mod
print(ans)


def power(x, a):
	if a <= 0:
		return 1
	z = power(x, a // 2)
	z = z * z % 998244353
	if a % 2:
		z = z * x % 998244353
	return z

def ncr(n, r):
	fact = [1]
	for i in range(1, n + 1):
		fact.append(i * fact[i - 1] % 998244353)
	return fact[n] * power(fact[r], 998244351) * power(fact[n - r], 998244351)
[n, m] = list(map(int, input().split()))
ans = ncr(m, n - 1) * (n - 2) % 998244353
ans = ans * power(2, n - 3) % 998244353
print(ans)


from sys import stdin

def ExtGCD(a, b):
	if a % b == 0:
		return (b, 0, 1)
	(g, x, y) = ExtGCD(b, a % b)
	return (g, y, x - a // b * y)

def inv(a, m):
	(_, _, y) = ExtGCD(m, a)
	return (y + m) % m

def modComb(a, b, m):
	ans = 1
	for x in range(1, min(b, a - b) + 1):
		ans = ans * (a - x + 1) % m
		ans = ans * inv(x, m) % m
	return ans

def modPow(a, b, m):
	ans = 1
	aa = a
	while b > 0:
		if b & 1:
			ans = ans * aa % m
		aa = aa * aa % m
		b >>= 1
	return ans

def solve(n, m):
	MOD = 998244353
	ax = modComb(m, n - 1, MOD) * (n - 2) % MOD
	ay = modPow(2, n - 3, MOD)
	return ax * ay % MOD
for line in stdin:
	(n, m) = map(int, line.split())
	print(solve(n, m))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, m) = map(int, input().split())
mod = 998244353

def C(n, k, mod):
	if k > n:
		return 0
	k = min(k, n - k)
	a = 1
	b = 1
	for i in range(k):
		a = a * (n - i) % mod
		b = b * (i + 1) % mod
	return a * pow(b, mod - 2, mod) % mod
a1 = C(m, n - 1, mod)
if n >= 3:
	a2 = pow(2, n - 3, mod)
else:
	a2 = 0
print(int(a1 * a2 * (n - 2)) % mod)


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
mod = 998244353
if n == 2:
	print(0)
	exit()
max_n = 2 * 10 ** 5 + 10
(fac, inv) = ([1] * max_n, [0] * max_n)
for i in range(2, max_n):
	fac[i] = fac[i - 1] * i % mod
inv[-1] = pow(fac[-1], mod - 2, mod)
for i in range(max_n - 1, 0, -1):
	inv[i - 1] = inv[i] * i % mod
ans = fac[m] * inv[n - 1] * inv[m - n + 1] * (n - 2) * pow(2, n - 3, mod) % mod
print(ans)


mod = 998244353
rng = 200100
fctr = [1]
for i in range(1, rng):
	fctr.append(fctr[-1] * i % mod)

def inv(x):
	return pow(x, mod - 2, mod)

def cmb(n, k):
	if n < 0 or k < 0:
		return 0
	else:
		return fctr[n] * inv(fctr[n - k]) * inv(fctr[k]) % mod
(n, m) = map(int, input().split())
if n == 2:
	print(0)
else:
	print(cmb(m, n - 1) * (n - 2) * pow(2, n - 3, mod) % mod)


from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, itertools, math
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
sqrt = math.sqrt

def LI():
	return list(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def LI_():
	return list(map(lambda x: int(x) - 1, input().split()))

def II():
	return int(input())

def IF():
	return float(input())

def S():
	return input().rstrip()

def LS():
	return S().split()

def IR(n):
	res = [None] * n
	for i in range(n):
		res[i] = II()
	return res

def LIR(n):
	res = [None] * n
	for i in range(n):
		res[i] = LI()
	return res

def FR(n):
	res = [None] * n
	for i in range(n):
		res[i] = IF()
	return res

def LIR(n):
	res = [None] * n
	for i in range(n):
		res[i] = IF()
	return res

def LIR_(n):
	res = [None] * n
	for i in range(n):
		res[i] = LI_()
	return res

def SR(n):
	res = [None] * n
	for i in range(n):
		res[i] = S()
	return res

def LSR(n):
	res = [None] * n
	for i in range(n):
		res[i] = LS()
	return res
mod = 998244353
inf = float('INF')

def solve():
	(n, m) = LI()
	fact = [i for i in range(m + 1)]
	fact[0] = 1
	for i in range(m):
		fact[i + 1] *= fact[i]
		fact[i + 1] %= mod
	invfact = [None] * (m + 1)
	invfact[m] = pow(fact[m], mod - 2, mod)
	for i in range(m - 1, 0, -1):
		invfact[i] = invfact[i + 1] * (i + 1)
		invfact[i] %= mod

	def com(n, k):
		if n < 0 or k < 0 or n < k:
			return 0
		if n == 0 or k == 0 or n == k:
			return 1
		return fact[n] * invfact[k] * invfact[n - k] % mod
	ans = com(m, n - 1)
	tmp = 0
	for i in range(1, n - 1):
		tmp += com(n - 2, i) * i
		tmp %= mod
	ans = ans * tmp % mod
	print(ans)
	return
solve()


(n, m) = map(int, input().split())
mod = 998244353
if n <= 2 or m <= 2:
	print(0)
elif m - n + 1 < 0:
	print(0)
else:

	def pow(n, p):
		if p == 0:
			return 1
		a = pow(n, p // 2) % mod
		b = a
		if p % 2 == 1:
			b = b * n
		b %= mod
		return a * b % mod
	fact = [1 for i in range(200010)]
	for i in range(1, 200002):
		fact[i] = fact[i - 1] * i
		fact[i] %= mod

	def inverseModulo(n):
		a = pow(n, mod - 2) % mod
		return a
	ans = fact[m]
	ans *= n - 2
	ans %= mod
	ans = ans * inverseModulo(fact[n - 1])
	ans %= mod
	ans *= inverseModulo(fact[m - n + 1])
	ans %= mod
	ans *= pow(2, n - 3)
	ans %= mod
	print(ans)


mod = 998244353

def ncr(n, r):
	num = 1
	den = 1
	for i in range(r):
		num = num * (n - i) % mod
		den = den * (i + 1) % mod
	return num * pow(den, mod - 2, mod) % mod
(n, m) = map(int, input().split())
c = ncr(m, n - 1) * pow(2, n - 2, mod)
c %= mod
c = c * (n - 2) % mod
c = c * pow(2, mod - 2, mod)
c %= mod
print(c)


mod = 998244353
fact = [1]
for i in range(1, 200005):
	fact.append(fact[-1] * i % mod)

def inv(x):
	return pow(x, mod - 2, mod)

def cnk(n, k):
	if n < 0 or k < 0:
		return 0
	else:
		return fact[n] * inv(fact[n - k]) * inv(fact[k]) % mod
(n, m) = map(int, input().split())
if n == 2:
	print(0)
else:
	print(cnk(m, n - 1) * (n - 2) * pow(2, n - 3, mod) % mod)


(n, m) = map(int, input().split())
M = 998244353
fact = [1]
for i in range(m):
	fact.append(fact[-1] * (i + 1) % M)
R_number = pow(fact[n - 1] * fact[m - n + 1] * 2, M - 2, M)
ans = fact[m] * R_number * (n - 2) * pow(2, n - 2, M) % M
print(ans)


import math
M = 998244353

def count_the_arrays(n, m):
	comb = c(m, n - 1, M)
	result = comb * ((n - 2) % M) % M * pow(2, n - 3, M) % M
	return result

def factorial(m):
	facts = [1 for _ in range(m + 1)]
	for n in range(1, m + 1):
		facts[n] = facts[n - 1] * n % M
	return facts

def c(n, k, M):
	f = factorial(max(n, k))
	(_, inv_n, _) = extended_euclidean_alg(f[k], M)
	(_, inv_n_k, _) = extended_euclidean_alg(f[n - k], M)
	return f[n] * (inv_n % M) % M * (inv_n_k % M) % M

def extended_euclidean_alg(a, b):
	if not b:
		return (0, 1, 0)
	(u0, u1) = (1, 0)
	(v0, v1) = (0, 1)
	while b:
		q = a // b
		r = a - b * q
		u = u0 - q * u1
		v = v0 - q * v1
		a = b
		b = r
		u0 = u1
		u1 = u
		v0 = v1
		v1 = v
	return (a, u0, v0)

def main():
	(n, m) = [int(i) for i in input().split()]
	count = count_the_arrays(n, m)
	print(int(count))
main()


mod = 998244353

def cmb(n, r, p):
	if r < 0 or n < r:
		return 0
	r = min(r, n - r)
	return fact[n] * factinv[r] * factinv[n - r] % p
p = mod
N = 5 * 10 ** 5
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
	fact.append(fact[-1] * i % p)
	inv.append(-inv[p % i] * (p // i) % p)
	factinv.append(factinv[-1] * inv[-1] % p)
(n, m) = map(int, input().split())
if n == 0:
	print(0)
else:
	res = 0
	import math
	for i in range(n - 1, m + 1):
		cres = 1
		cres *= i - 1
		res %= mod
		cres *= cmb(i - 2, n - 3, mod)
		res %= mod
		cres *= pow(2, n - 3, mod)
		res += cres
		res %= mod
	print(res)


mod = 998244353

def C(n, m):
	ans = 1
	for i in range(1, m + 1):
		ans = ans * (n - m + i) % mod
		ans = ans * pow(i, mod - 2, mod)
	return ans
(n, m) = map(int, input().split())
if n == 2:
	print(0)
else:
	ans = C(m, n - 1) * (n - 2) % mod * pow(2, n - 3, mod) % mod
	print(ans)


(n, m) = map(int, input().split())
if n == 2:
	print(0)
	exit()
mod = 998244353
MAX_N = 200004
fact = [1]
fact_inv = [0] * (MAX_N + 4)
for i in range(MAX_N + 3):
	fact.append(fact[-1] * (i + 1) % mod)
fact_inv[-1] = pow(fact[-1], mod - 2, mod)
for i in range(MAX_N + 2, -1, -1):
	fact_inv[i] = fact_inv[i + 1] * (i + 1) % mod

def mod_comb_k(n, k, mod):
	return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod
res = mod_comb_k(m, n - 1, mod) * (n - 2) % mod * pow(2, n - 3, mod) % mod
print(res)


import sys

def main():

	def GCD(x, y):
		while y:
			(x, y) = (y, x % y)
		return x

	def lcm(a, b):
		return a * b // GCD(a, b)

	def merge(a, start, mid, end, d):
		p = start
		q = mid + 1
		arr = [0] * (end - start + 1)
		k = 0
		coun = 0
		for i in range(start, end + 1):
			if p > mid:
				arr[k] = a[q]
				q += 1
				k += 1
			elif q > end:
				arr[k] = a[p]
				d[a[p]] += coun
				k += 1
				p += 1
			elif a[p] < a[q]:
				arr[k] = a[p]
				d[a[p]] += coun
				k += 1
				p += 1
			else:
				arr[k] = a[q]
				k += 1
				q += 1
				coun += 1
		for i in range(k):
			a[start] = arr[i]
			start += 1

	def mergesort(a, start, end, d):
		if start < end:
			mid = (start + end) // 2
			mergesort(a, start, mid, d)
			mergesort(a, mid + 1, end, d)
			merge(a, start, mid, end, d)

	def inversion(l):
		d = {}
		for i in l:
			d[i] = 0
		mergesort(l, 0, len(l) - 1, d)
		return d

	def binary_search_lower(A, low, high, k):
		if high - low != 1:
			mid = (low + high) // 2
			x = A[mid]
			if x <= k:
				return binary_search_lower(A, low, mid, k)
			else:
				return binary_search_lower(A, mid, high, k)
		if A[low] <= k:
			return low
		else:
			return high

	def binary_expo(x, n):
		if n == 0:
			return 1
		elif n % 2 == 0:
			return binary_expo(x * x, n // 2)
		else:
			return x * binary_expo(x * x, (n - 1) // 2)

	def modu_expo(x, n, m):
		if n == 0:
			return 1
		elif n % 2 == 0:
			return modu_expo(x * x % m, n // 2, m)
		else:
			return x * modu_expo(x * x % m, (n - 1) // 2, m) % m

	def eEuclid(c, m):
		if m == 0:
			global d
			global x
			global y
			d = c
			x = 1
			y = 0
		else:
			eEuclid(m, c % m)
			temp = x
			x = y
			y = temp - c // m * y

	def mod_Inv(c, m):
		eEuclid(c, m)
		return (x % m + m) % m

	def ncr(n, r, p):
		num = den = 1
		for i in range(r):
			num = num * (n - i) % p
			den = den * (i + 1) % p
		return num * pow(den, p - 2, p) % p
	mod = 998244353
	(a, b) = map(int, sys.stdin.readline().split())
	ans = 0
	if a > 2:
		x = ncr(b, a - 1, mod)
		y = a - 2
		z = modu_expo(2, a - 3, mod)
		ans = x * y * z % mod
	print(ans)
main()


M = 998244353
f = [1]
for i in range(4 ** 9):
	f += (f[-1] * (i + 1) % M,)
(n, m) = map(int, input().split())
print((n - 2) * pow(2, n - 3, M) * f[m] * pow(f[n - 1] * f[m - n + 1], M - 2, M) % M)


def nc(n, r, mod):
	a = b = 1
	for i in range(min(r, n - r)):
		a = a * (n - i) % mod
		b = b * (i + 1) % mod
	return a * pow(b, mod - 2, mod) % mod
(n, m) = map(int, input().split())
x = 1
mod = 998244353
for i in range(n - 3):
	x = x * 2
	x = x % mod
c = nc(m, n - 1, mod) * (n - 2) * x % mod
print(c)


(n, m) = map(int, input().split())
if n == 2:
	print(0)
	exit()
mod = 998244353

def cb(n, k):
	global mod
	ret = a = b = 1
	for i in range(k):
		a *= n - i
		a %= mod
		b *= i + 1
		b %= mod
	m = mod - 2
	while m > 0:
		if m % 2 != 0:
			ret *= b
			ret %= mod
		b *= b
		b %= mod
		m //= 2
	ret *= a
	ret %= mod
	return ret

def two_pow(n):
	global mod
	ret = 1
	two = 2
	while n:
		if n & 1:
			n -= 1
			ret *= two
			ret %= mod
		two *= two
		two %= mod
		n //= 2
	return ret
ans = cb(m, n - 1)
ans *= two_pow(n - 3)
ans %= mod
ans *= n - 2
ans %= mod
print(ans)


from math import gcd
import sys

def input():
	return sys.stdin.readline().rstrip()
MOD = 998244353

class CHOOSE:

	def __init__(self, N, mod=998244353):
		self.power = [1 for _ in range(N + 1)]
		self.rev = [1 for _ in range(N + 1)]
		self.mod = mod
		for i in range(2, N + 1):
			self.power[i] = self.power[i - 1] * i % self.mod
		self.rev[N] = pow(self.power[N], self.mod - 2, self.mod)
		for j in range(N, 0, -1):
			self.rev[j - 1] = self.rev[j] * j % self.mod

	def c(self, K, R):
		if not 0 <= R <= K:
			return 0
		else:
			return self.power[K] * self.rev[K - R] * self.rev[R] % self.mod

	def p(self, K, R):
		if not 0 <= R <= K:
			return 0
		else:
			return self.power[K] * self.rev[K - R] % self.mod
c = CHOOSE(200010)

def slv():
	(n, m) = map(int, input().split())
	if n == 2:
		print(0)
	else:
		ans = c.c(m, n - 1) * (n - 2) * pow(2, n - 3, MOD)
		print(ans % MOD)
	return

def main():
	t = 1
	for _ in range(t):
		slv()
	return
main()


printn = lambda x: print(x, end='')
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
ins = lambda : input().strip()
DBG = True
BIG = 10 ** 18
R = 998244353

def ddprint(x):
	if DBG:
		print(x)

def modinv2(x, r):
	return pow(x, r - 2, r)

def comb(n, a, R):
	dend = 1
	for i in range(a):
		dend = dend * (n - i) % R
	sor = 1
	for i in range(2, a + 1):
		sor = sor * i % R
	return dend * modinv2(sor, R) % R
(n, m) = inm()
if n == 2:
	print(0)
	exit()
print(comb(m, n - 1, R) * (n - 2) * pow(2, n - 3, R) % R)


MOD = 998244353
BIG = 1000000
fac = [1] * BIG
for i in range(1, BIG):
	fac[i] = i * fac[i - 1] % MOD

def choose(n, k):
	return fac[n] * pow(fac[k] * fac[n - k] % MOD, MOD - 2, MOD) % MOD
(n, m) = map(int, input().split())
if n == 2:
	print(0)
else:
	print(choose(m, n - 1) * (n - 2) * pow(2, n - 3, MOD) % MOD)


from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt, factorial

def read_int():
	return int(input().strip())

def read_int_array():
	return [int(i) for i in input().strip().split(' ')]
MOD = 998244353

def binpow(a, n, mod):
	if n == 0:
		return 1
	if n == 1:
		return a
	if n % 2 == 1:
		return binpow(a, n - 1, mod) * a % mod
	b = binpow(a, n // 2, mod)
	return b * b % mod

def comb(n, k):
	x = 1
	for i in range(n - k + 1, n + 1):
		x = x * i % MOD
	y = 1
	for i in range(2, k + 1):
		y = y * i % MOD
	y = binpow(y, MOD - 2, MOD)
	return x * y % MOD

def mypow(a, x):
	return a ** x % MOD

def solve():
	(n, m) = read_int_array()
	if n == 2:
		print(0)
		return
	ans = comb(m, n - 1)
	ans = ans * (n - 2) % MOD
	ans = ans * mypow(2, n - 3) % MOD
	print(int(ans))
solve()


def main():
	import sys
	input = sys.stdin.readline
	mod = 998244353
	nmax = 2 * 10 ** 5 + 10
	fac = [0] * nmax
	finv = [0] * nmax
	inv = [0] * nmax
	fac[0] = 1
	fac[1] = 1
	finv[0] = 1
	finv[1] = 1
	inv[1] = 1
	for i in range(2, nmax):
		fac[i] = fac[i - 1] * i % mod
		inv[i] = mod - inv[mod % i] * (mod // i) % mod
		finv[i] = finv[i - 1] * inv[i] % mod

	def comb(n, r):
		if n < r:
			return 0
		else:
			return fac[n] * (finv[r] * finv[n - r] % mod) % mod
	(N, M) = map(int, input().split())
	if N == 2:
		print(0)
		exit()
	print(comb(M, N - 1) * (N - 2) % mod * pow(2, N - 3, mod) % mod)
main()


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 998244353

class ModTools:

	def __init__(self, MAX, MOD):
		MAX += 1
		self.MAX = MAX
		self.MOD = MOD
		factorial = [1] * MAX
		factorial[0] = factorial[1] = 1
		for i in range(2, MAX):
			factorial[i] = factorial[i - 1] * i % MOD
		inverse = [1] * MAX
		inverse[MAX - 1] = pow(factorial[MAX - 1], MOD - 2, MOD)
		for i in range(MAX - 2, 0, -1):
			inverse[i] = inverse[i + 1] * (i + 1) % MOD
		self.fact = factorial
		self.inv = inverse

	def nCr(self, n, r):
		if n < r:
			return 0
		r = min(r, n - r)
		numerator = self.fact[n]
		denominator = self.inv[r] * self.inv[n - r] % self.MOD
		return numerator * denominator % self.MOD
(N, M) = MAP()
mt = ModTools(M, MOD)
if N == 2:
	print(0)
	exit()
ans = mt.nCr(M, N - 1) * (N - 2) * pow(2, N - 3, MOD) % MOD
print(ans)


mod = 998244353
(n, m) = [int(i) for i in input().split()]
fct = [1, 1]
for i in range(300000):
	fct.extend([fct[i + 1] * (i + 2) % mod])
ans = 0
newval = 0
val = fct[m] * pow(fct[n - 1] * fct[m - (n - 1)] % mod, mod - 2, mod) % mod
if n >= 3:
	for i in range(n - 1):
		newval += fct[n - 2] * pow(fct[i] * fct[n - 2 - i] % mod, mod - 2, mod) * i
		newval %= mod
val *= newval
print(val % mod)


from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
(n, m) = gil()
if n == 2:
	print(0)
else:
	p = [1] * n
	mod = 998244353
	for i in range(1, n):
		p[i] = 2 * p[i - 1] % mod
	print(p[n - 3] * ncr(m, n - 1, mod) * (n - 2) % mod)


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
(n, m) = map(int, input().split())
modulo = 998244353
limit = 2 * 10 ** 5 + 2
fact = [0] * limit
fact[0] = 1
for i in range(1, limit):
	fact[i] = fact[i - 1] * i % modulo

def inv(num, modulo):
	return pow(num, modulo - 2, modulo)

def binom(n, k, modulo):
	if n < k:
		return 0
	if n == k:
		return 1
	if k == 0:
		return 1
	return fact[n] * inv(fact[n - k] * fact[k], modulo) % modulo

def countArr(n, m):
	if n < 3:
		return 0
	ans = 0
	free = 0
	permut = pow(2, n - 3, modulo)
	for top in range(n - 1, m + 1):
		inc_arr = binom(top - 1, n - 3, modulo)
		free += 1
		ans = (ans + inc_arr * free * permut) % modulo
	return ans
print(countArr(n, m))


import sys
input = sys.stdin.readline

def main():
	t = 1
	while t:
		t -= 1
		MOD = 998244353
		fact = [1] * 200005
		for i in range(1, 200005):
			fact[i] = i * fact[i - 1] % MOD

		def fast_sq(a, b):
			ans = 1
			if b == -1:
				b = MOD - 2
			for i in range(60):
				if 1 << i & b:
					ans *= a
					ans %= MOD
				a *= a
				a %= MOD
			return ans
		(n, m) = map(int, input().split())
		print(fact[m] * (n - 2) * fast_sq(2, n - 3) * fast_sq(fact[n - 1] * fact[m - n + 1], -1) % MOD)
main()


import math

def modinv(n, p):
	return pow(n, p - 2, p)
import operator as op
from functools import reduce

def ncr(n, r, mod):
	a = min(r, n - r)
	b = max(r, n - r)
	num = 1
	den = 1
	for i in range(b + 1, n + 1):
		num = num * i % mod
	for i in range(1, a + 1):
		den = den * i % mod
	return num % mod * modinv(den, mod) % mod

def main():
	(n, m) = [int(x) for x in input().split()]
	if n == 2:
		print(0)
		return
	mod = 998244353
	k = ncr(m, n - 1, mod) % mod
	if n > 2:
		k = k * (n - 2) % mod
		for i in range(n - 3):
			k = k * 2 % mod
	else:
		pass
	print(k)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


num_inp = lambda : int(input())
arr_inp = lambda : list(map(int, input().split()))
sp_inp = lambda : map(int, input().split())
str_inp = lambda : input()
M = 998244353
(n, m) = map(int, input().split())
f = {}
f[0] = 1
for i in range(1, m + 1):
	f[i] = f[i - 1] * i % M
ans = (n - 2) * pow(2, n - 3, M) * f[m] * pow(f[n - 1] * f[m - n + 1], M - 2, M) % M
print(ans)


mod = 998244353
fact = [1, 1]
for i in range(2, 200001):
	fact.append(fact[i - 1] * i % mod)

def ncr(n, r):
	m = pow(fact[r] * fact[n - r], mod - 2, mod)
	return fact[n] * m % mod
(n, m) = map(int, input().split())
if n > 2:
	ans = ncr(m, n - 1) * (n - 2) * pow(2, n - 3, mod)
	print(ans % mod)
else:
	print(0)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
from collections import defaultdict
from heapq import heappop, heappush, heapify
(n, m) = map(int, input().split())
mod = 998244353
if n == 2:
	print(0)
	exit()
print(ncr(m, n - 1, mod) * (n - 2) % mod * pow(2, n - 3, mod) % mod)


import sys
input = sys.stdin.readline

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
INF = 10 ** 20
MOD = 998244353
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(n, m) = I()
if n > m + 1:
	print(0)
	exit()
MAXN = 300000
f = [1] * MAXN
for i in range(1, MAXN):
	f[i] = i * f[i - 1]
	f[i] %= MOD

def inverse(k):
	return pow(k, MOD - 2, MOD)

def nCk(n, k):
	if k > n:
		return 0
	return f[n] * inverse(f[n - k]) * inverse(f[k]) % MOD
ans = nCk(m, n - 1)
ans = ans * pow(2, n - 3, MOD) * (n - 2) % MOD
print(ans % MOD)


import math
import sys
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]
INF = 10 ** 18
MOD = 10 ** 9 + 7

def storefactorial(N, M):
	Ans = 1
	Z = [1]
	for i in range(1, N + 1):
		Ans *= i
		Ans %= M
		Z.append(Ans)
	return Z
F = storefactorial(2 * 100000, 998244353)

def powerof2(N, M):
	Ans = 1
	Z = [1]
	for i in range(N):
		Ans *= 2
		Ans %= M
		Z.append(Ans)
	return Z
G = powerof2(2 * 100000, 998244353)
M = 998244353
(n, m) = ilele()
if n == 2:
	print(0)
else:
	a = F[m]
	b = F[m - n + 1] * F[n - 1] % M
	c = a * pow(b, M - 2, M) % M
	d = c * (n - 2) % M
	e = d * G[n - 3] % M
	print(e)


import sys
input = sys.stdin.readline
p = 998244353
pri = p
fac = [1 for i in range(10 ** 6 + 1)]
for i in range(2, len(fac)):
	fac[i] = fac[i - 1] * (i % pri) % pri

def modi(x):
	return pow(x, p - 2, p) % p

def ncr(n, r):
	x = fac[n] * (modi(fac[r]) % p * (modi(fac[n - r]) % p)) % p % p
	return x
(n, m) = map(int, input().split())
if n == 2:
	print(0)
	exit(0)
if n == 3:
	print(m * (m - 1) // 2 % pri)
	exit(0)
way = 0
for i in range(1, m + 1):
	less = i - 1
	if less - 1 < n - 3:
		continue
	way += ncr(less, 1) * ncr(less - 1, n - 3) * pow(2, n - 3, pri)
print(way % p)


(n, m) = [int(x) for x in input().split()]
MOD = 998244353
MAX = m
fact = [1]
for zz in range(1, MAX + 1):
	fact.append(fact[-1] % MOD * zz % MOD % MOD)

def nCr(n, r):
	num = fact[n]
	den = fact[r] % MOD * (fact[n - r] % MOD) % MOD
	return num % MOD * pow(den, MOD - 2, MOD) % MOD
nWaysChooseElements = nCr(m, n - 1)
nWaysLeftElements = 0
for left in range(1, n - 1):
	nWaysLeftElements += nCr(n - 2, left) * left % MOD
	nWaysLeftElements %= MOD
ans = nWaysLeftElements * nWaysChooseElements
ans %= MOD
print(ans)


(n, m) = list(map(int, input().split()))
mod = 998244353
if n > 2:
	l = n - 1
	(c, d, u) = ([1], [1], [1])
	for i in range(1, l + 1):
		c.append(c[-1] * (m - i + 1) % mod)
		d.append(d[-1] * i % mod)
		u.append(c[-1] * pow(d[i], mod - 2, mod))
	p = u[l]
	print(pow(2, n - 3) * (n - 2) * p % mod)
else:
	print(0)


def main():
	import sys
	input = sys.stdin.readline
	N = 2 * 10 ** 5 + 3
	mod = 998244353
	fac = [1] * (N + 1)
	for i in range(1, N + 1):
		fac[i] = fac[i - 1] * i % mod
	inv_fac = [1] * (N + 1)
	inv_fac[N] = pow(fac[N], mod - 2, mod)
	for i in range(N - 1, 0, -1):
		inv_fac[i] = inv_fac[i + 1] * (i + 1) % mod

	def nCr(n, r):
		if n <= 0 or r < 0 or r > n:
			return 0
		return fac[n] * inv_fac[r] % mod * inv_fac[n - r] % mod
	(n, m) = map(int, input().split())
	ans = (n - 2) * pow(2, n - 3, mod=mod) % mod * nCr(m, n - 1) % mod
	print(ans)
main()


from math import *
(n, m) = map(int, input().split())
ans = 0
M = 998244353

def mul(x, y):
	return x * y % M

def add(x, y):
	return (x + y) % M

def p(x, y):
	res = 1
	x = x % M
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % M
		y = y >> 1
		x = x * x % M
	return res

def div(x, y):
	return mul(x, p(y, M - 2))
fact = [0] * (2 * 10 ** 5 + 1)
fact[0] = 1
for i in range(1, len(fact)):
	fact[i] = mul(fact[i - 1], i)
ans = div(fact[m], mul(fact[n - 1], fact[m - n + 1]))
ans = mul(ans, p(2, n - 3))
ans = mul(ans, n - 2)
print(ans)


import sys
import os
import io
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
import math

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def si():
	return input()

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def li():
	return list(map(int, input().split()))
t = 1
mod = 998244353
for _ in range(t):
	(n, m) = li()
	if n == 2:
		print(0)
		continue
	ans = pow(2, n - 3, mod) * (n - 2) * ncr(m, n - 1, mod)
	ans = ans % mod
	print(ans)


def binpow(a, b, MOD):
	if b == 0:
		return 1
	res = binpow(a, b // 2, MOD)
	if b % 2 == 0:
		return res % MOD * (res % MOD) % MOD
	return res % MOD * (res % MOD) % MOD * (a % MOD) % MOD

def inverse(val, M):
	return binpow(val, M - 2, M)

def C(n, m, f, MOD):
	num = f[m]
	denum = f[n] * f[m - n] % MOD
	denum = inverse(denum, MOD)
	return num * denum % MOD

def solve():
	MOD = 998244353
	(n, m) = map(int, input().split())
	pow = [1 for _ in range(n)]
	f = [1 for _ in range(m + 1)]
	for i in range(1, n):
		pow[i] = pow[i - 1] * 2 % MOD
	for i in range(2, m + 1):
		f[i] = f[i - 1] * i % MOD
	mtp1 = C(n - 1, m, f, MOD) * (n - 2) % MOD
	mtp2 = pow[n - 3]
	ans = mtp1 * mtp2 % MOD
	print(ans)
solve()


(n, m) = list(map(int, input().split()))

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def power(x, y, p):
	res = 1
	x = x % p
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
if n == 2:
	print(0)
else:
	module = 998244353
	res = ncr(m, n - 1, module) * (n - 2) * power(2, n - 3, 998244353)
	res = res % 998244353
	print(res)