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)

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(1e9)+7
inf = float("inf")

def ncr(n, r, p):
    # initialize numerator
    # and denominator
    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)

# -*- coding: utf-8 -*-
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))

if __name__ == '__main__':
    main()

#!/usr/bin/env python3

import sys
from math import *
from collections import defaultdict
from queue import deque                # Queues
from heapq import heappush, heappop    # Priority Queues
M = 998244353
invcache = {}

# parse
lines = [line.strip() for line in sys.stdin.readlines()]
n, m = list(map(int, lines[0].split()))

# precompute
facts = [1]
pows = [1]
for i in range(1, m+1):
  facts += [facts[-1] * i % M]
  pows += [pows[-1] * 2 % M]

# mod inv
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, collections, sys
input = sys.stdin.readline
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())
mod = 998244353
if n == 2:
    print(0)
else:
    ans = ncr(m, n-1, mod)
    ans*=(n-2)
    ans%=mod
    ans*=pow(2, n-3, mod)
    ans%=mod
    print(ans)

# -*- coding: utf-8 -*-

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')
# sys.setrecursionlimit(10 ** 9)
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 = 0
for k in range(M, N-2, -1):
    ans += mt.nCr(k-1, N-2) * (N-2) * pow(2, N-3, MOD) % MOD
    ans %= MOD
print(ans)

import sys

# inf = open('input.txt', 'r')
# reader = (line.rstrip() for line in inf)
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))

# inf.close()

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 ;print((ncr(m,n-1,p)*(n-2)*pow(2,max((n-3),0),p))%p)

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)

# ------------------- fast io --------------------
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")

# ------------------- fast io --------------------
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 os
import sys
from io import BytesIO, IOBase
# region fastio

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))

if __name__ == "__main__":
    main()

# Python3 function to
# calculate nCr % p
def ncr(n, r, p):
	# initialize numerator
	# and denominator
	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 must be a prime
# greater than n
# n, r, p = 10, 2, 13
# print("Value of nCr % p is",
# 			ncr(n, r, p))

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

ans = ncr(m,n-1,p)

ans = (ans%p *(n-2)%p)%p
for i in range(n-3):
    ans = (ans*2)%p
print(ans)

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

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))

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)

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)

from bisect import *
from math import *
mod = 998244353
def bin_exp(a, n):
	#gives a**n mod 10**9 +7

	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):
	# n th position gives (n)!...i.e 0 th position gives 0!, 1st position gives 1! and so on
	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)

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)

def binm(n, r,p):
    # initialize numerator
    # and denominator
    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=[int(i) for i in raw_input().split()]
mod=998244353
if n==2:
    print 0
else:
    val=1
    for i in range(n-3):
        val*=2
        val%=mod
    print ((n-2)*val*binm(m,n-1,mod))%mod

import sys
# sys.setrecursionlimit(10**6)
from sys import stdin, stdout
import bisect            #c++ upperbound
import math
import heapq
def modinv(n,p):
    return pow(n,p-2,p)
def cin():
    return map(int,sin().split())
def ain():                           #takes array as input
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
import math
def Divisors(n) :
    l = []
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) :
            if (n // i == i) :
                l.append(i)
            else :
                l.append(i)
                l.append(n//i)
    return l
def modInverse(b,m):
    # g = math.gcd(b, m)
    return pow(b, m - 2, m)
# Function to compute a/b under modulo m
def modDivide(a,b,m):
    a = a % m
    inv = modInverse(b,m)
    return (inv*a) % m
def intersection(lst1, lst2):
    lst3 = [value for value in lst1 if value in lst2]
    return lst3
"""*******************************************************"""
def main():
    n,m=cin()
    f=[1]
    mod=998244353
    for i in range(1,200005):
        f.append((i*f[i-1])%mod)
    # print(f[:10])

    x=pow(2,max(0,n-3),mod)
    j=0
    for i in range(n-2,m):
        # print(n-2,i-n+2,i)
        p=f[n-2]
        q=f[i-n+2]
        r=f[i]
        r=modDivide(r,p,mod)
        r=modDivide(r,q,mod)
        # print(r)
        j=(j+r)%mod
    x=(x*j)%mod
    x=x*(n-2)%mod
    print(x)

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

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')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

if __name__== "__main__":
  main()

import sys
range = xrange
input = raw_input

MOD = 998244353

n,m = [int(x) for x in input().split()]

if n == 2:
    print 0
    sys.exit()

k = n - 2
big = 3 * 10**5
choose = [0] * big
choose[k] = 1
for i in range(k + 1, big):
    choose[i] = choose[i - 1] * i * pow(i - k, MOD - 2, MOD) % MOD

s = 0
for maxval in range(n - 1, m + 1):
    s = (s + choose[maxval - 1] * pow(2, n - 3, MOD) * (n - 2)) % MOD
print s

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 input():
#    return stdin.buffer.readline()

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))

if __name__ == "__main__":
    main()

from sys import stdin, gettrace

MOD = 998244353

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 input():
#    return stdin.buffer.readline()

def main():
    n,m = map(int, input().split())
    if n == 2:
        print(0)
        return
    ModInt = modInt(MOD)
    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) * pow(2,n-3, MOD)

    print(int(sum))

if __name__ == "__main__":
    main()

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 input():
#    return stdin.buffer.readline()

def main():
    n,m = map(int, input().split())
    if n == 2:
        print(0)
        return
    ModInt = modInt(998244353)
    sum = ModInt(0)
    factorial = [ModInt(1)]

    def comb(m, i):
        return factorial[m]/(factorial[i] * factorial[m-i])

    for i in range(1, m+1):
        factorial.append(factorial[-1] * ModInt(i))
    # for i in range(1, n-1):
    #     l = i+1
    #     s = n - i
    #     if l < s:
    #         l,s = s,l
    #     lseq = comb(m,l)
    #     dvals = l-1
    #     sseq = comb(m - l - 1, s - 2)
    #     sum += lseq*dvals*sseq
    sum = comb(m,n-1) * (n-2) * 2**(n-3)

    print(int(sum))

if __name__ == "__main__":
    main()

from sys import stdin
from collections import deque
mod = 10**9 + 7
import sys
import random
# sys.setrecursionlimit(10**6)
from queue import PriorityQueue
# def rl():
#     return [int(w) for w in stdin.readline().split()]
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt,factorial,gcd,log2,inf,ceil
# map(int,input().split())
# # l = list(map(int,input().split()))
# from itertools import permutations
import heapq
# input = lambda: sys.stdin.readline().rstrip()
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(x, y):
#     return f(x) // (f(y) * f(x - y))
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

# t = int(input())
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
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush,heappop,heapify
from itertools import permutations,combinations
mod = int(1e9)+7
mod = 998244353

ip = lambda : int(stdin.readline())
inp = lambda: map(int,stdin.readline().split())
ips = lambda: stdin.readline().rstrip()
out = lambda x : stdout.write(str(x)+"\n")

nn = int(2e5)+1
f = 1
fac = [0]*nn
fac[0] = 1
for i in range(1,nn):
    f *= i
    f %= mod
    fac[i] = f

t = 1
for _ in range(t):
    n,m = inp()
    if n == 2:
        ans = 0
    else:
        num = fac[m]
        den = fac[n-1]*fac[m-n+1]
        den = pow(den,mod-2,mod)
        ans = (num*den)%mod
        ans *= (n-2)
        ans %= mod
        ans *= pow(2,n-3,mod)
        ans %= mod
    out(ans)

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)

import sys
input = sys.stdin.readline
def main():
  #  t = int(input())
    t = 1
    while(t):
  #  for _ in range(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()

#!/usr/bin/env python3
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')

#solve
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

#main
if __name__ == '__main__':
    solve()

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  # N は必要分だけ用意する
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())
res = 0
import math
if n == 2:
    print(0)
else:
    for i in range(n-1, m+1):
        res += (i - 1) * cmb(i - 2, n - 3, mod) * pow(2, n-3, mod)
        res %= mod
    print(res)

import sys
input = sys.stdin.readline
from collections import *

MAX = 2*10**5+100
MOD = 998244353
fact = [0]*MAX #fact[i]: i!
inv = [0]*MAX #inv[i]: iの逆元
finv = [0]*MAX #finv[i]: i!の逆元
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)

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 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
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)

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)

import math
def ncr(n, r, p):
    # initialize numerator
    # and denominator
    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=int(input())
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)

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()

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

# p must be a prime
# greater than n

n,m= map(int, input().split())
print(ncr(m, (n-1),998244353 ))

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)

#!/usr/bin/env python3

import sys
from math import *
from collections import defaultdict
from queue import deque                # Queues
from heapq import heappush, heappop    # Priority Queues
M = 998244353

# parse
lines = [line.strip() for line in sys.stdin.readlines()]
n, m = list(map(int, lines[0].split()))

# mod inv
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):
  g, x, y = gcdext(a, M)
  assert(g == 1)
  return x % M

# precompute
facts = [1]
factinvs = [1]
pows = [1]
for i in range(1, m+1):
  facts += [facts[-1] * i % M]
  pows += [pows[-1] * 2 % M]
  factinvs += [factinvs[-1] * modinv(i) % M]

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] * factinvs[b] % M * factinvs[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)

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()

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  # N は必要分だけ用意する
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)

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())
#sys.setrecursionlimit(100000)

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)

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 # and False
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)

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))

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class mint:
    def __init__(self, x):
        self.__x = x % md

    def __str__(self):
        return str(self.__x)

    def __neg__(self):
        return mint(-self.__x)

    def __add__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x + other)

    def __sub__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x - other)

    def __rsub__(self, other):
        return mint(other - self.__x)

    def __mul__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * other)

    __radd__ = __add__
    __rmul__ = __mul__

    def __truediv__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * pow(other, md - 2, md))

    def __rtruediv__(self, other):
        return mint(other * pow(self.__x, md - 2, md))

    def __pow__(self, power, modulo=None):
        return mint(pow(self.__x, power, md))

md = 998244353

def nCr(com_n, com_r):
    if com_n < com_r: return 0
    return fac[com_n] * ifac[com_r] * ifac[com_n - com_r]

n_max = 200000
fac = [mint(1)]
for i in range(1, n_max + 1): fac.append(fac[-1] * i)
ifac = [mint(1)] * (n_max + 1)
ifac[n_max] /= fac[n_max]
for i in range(n_max - 1, 1, -1): ifac[i] = ifac[i + 1] * (i + 1)

def main():
    n,m=MI()
    ans=nCr(m,n-1)*(n-2)*pow(2,n-3,md)
    print(ans)

main()

def ncr(n, r, p):
    # initialize numerator
    # and denominator
    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 must be a prime
# greater than n
# n, r, p = 10, 2, 13
# print("Value of nCr % p is",
# 			ncr(n, r, p))

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

ans = ncr(m, n - 1, p)

ans = (ans * (n - 2) % p) % p
for i in range(n - 3):
    ans = (ans * 2) % p
print(ans)

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]

# number of different elements = n-1
# options for element choice = binom(m, n-1)
# options for duplicate element = n - 2
# 2 options for position of all elements except duplicate element and element i (n -3)

def solve(n, m, mod):
    result = n - 2 # options for duplicate element
    result %= mod
    if result == 0: return 0

    for duplicate in range(n - 3): # positions of elements
        result *= 2
        result %= mod
        if result == 0: return 0

    # times binom(m, n-1)
    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))

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)

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)

# cook your dish here
import sys,math

def nCr(n, r, p):
    # initialize numerator
    # and denominator
    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()

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 ;print((ncr(m,n-1,p)*(n-2)*pow(2,max((n-3),0),p))%p)

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 )

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

if n == 2:
	print(0)
	exit()

mod = 998244353
ans = ((n-2) * pow(2, n-3, mod)) % mod
# print(ans)
for i in range(m-n+2, m+1):
	ans = (ans * i) % mod
# print(ans)
fact = 1
for i in range(2, n):
	fact = (fact*i) % mod

fact = pow(fact, mod-2, mod)
ans = (ans * fact) % mod

print(ans)

#!python3
"""
Author: w1ld [at] inbox [dot] ru
"""

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

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))

if __name__ == '__main__':
    solve()

# -*- coding: utf-8 -*-

class FactMod():
    def __init__(self, n, mod):
        self.mod = mod
        self.f = [1]*(n+1)
        for i in range(1, n+1):
            self.f[i] = self.f[i-1]*i % 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)

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)

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

from sys import stdin, stdout
from collections import Counter, defaultdict
from itertools import permutations, combinations
from fractions import gcd
import heapq
raw_input = stdin.readline
pr = stdout.write
mod=998244353

def ni():
    return int(raw_input())

def li():
    return list(map(int,raw_input().split()))

def pn(n):
    stdout.write(str(n)+'\n')

def pa(arr):
    pr(' '.join(map(str,arr))+'\n')

# fast read function for total integer input

def inp():
    # this function returns whole input of
    # space/line seperated integers
    # Use Ctrl+D to flush stdin.
    return tuple(map(int,stdin.read().split()))

range = xrange # not for python 3.0+

# main code

def inv(x):
    return pow(x,mod-2,mod)
n,m=li()
if n==2:
    print 0
    exit()
fac=[1]*(m+1)
for i in range(1,m+1):
    fac[i]=(i*fac[i-1])%mod
ans=(fac[m]*inv((fac[n-1]*fac[m-n+1])%mod))%mod
ans=(ans*(n-2))%mod
ans=(ans*pow(2,n-3,mod))%mod
pn(ans)

from sys import stdin

def fact(be, en):
    res = 1
    for i in range(be, en + 1):
        res = mult(res, i)
    return res

rints = lambda: [int(x) for x in stdin.readline().split()]
mult = lambda a, b: ((a % mod) * (b % mod)) % mod
modinv = lambda a: pow(a, mod - 2, mod)
div = lambda a, b: mult(a, modinv(b))
ncr = lambda n, r: div(fact(n - r + 1, n), fact(1, r))
mod = 998244353

n, m = rints()
if n > 2:
    print(mult(mult(ncr(m, n - 1), n - 2), pow(2, n - 3, mod)))
else:
    print(0)

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)

"""
#If FastIO not needed, used this and don't forget to strip
#import sys, math
#input = sys.stdin.readline
"""

import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right

from types import GeneratorType
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        import os
        self.os = os
        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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
            self.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 collections import defaultdict as dd, deque as dq
import math, string

def getInts():
    return [int(s) for s in input().split()]

def getInt():
    return int(input())

def getStrs():
    return [s for s in input().split()]

def getStr():
    return input()

def listStr():
    return list(input())

MOD = 998244353

"""
If N < 3, the answer is 0

We must have a max element, which is unique, and can be in any position from 2 to N-1 inclusive
There are N-1 *distinct* elements, so the max element can range from N-1 to M

Given the max element, we can then pick 1 number from 1 to max-1 inclusive and include it on boths sides
We can then choose N-3 numbers from the remaining max-2 numbers (max-2 choose N-3), and these can be placed in pow(2,N-3) ways each

So, answer is sum i=N-1 to M ( (i-1)*(max-2 choose N-3)*(pow(2,N-3) )

"""
pows = [1]
curr = 1
for j in range(1,200001):
    curr *= 2
    curr %= MOD
    pows.append(curr)

facs = [1]
curr = 1
for j in range(1,200001):
    curr *= j
    curr %= MOD
    facs.append(curr)

inv_facs = []
for j in range(200001):
    inv_facs.append(pow(facs[j],MOD-2,MOD))

def solve():
    N, M = getInts()
    if N == 2:
        return 0
    ans = 0
    for i in range(N-1,M+1):
        tmp = (i-1)
        tmp *= facs[i-2]
        tmp %= MOD
        #print(tmp)
        tmp *= inv_facs[N-3]
        tmp %= MOD
        #print(tmp)
        tmp *= inv_facs[i-N+1]
        tmp %= MOD
        #print(tmp)
        tmp *= pows[N-3]
        tmp %= MOD
        #print(tmp,i)
        ans += tmp
        ans %= MOD
    return ans

#for _ in range(getInt()):
print(solve())

"""
    Template written to be used by Python Programmers.
    Use at your own risk!!!!
    Owned by enraged(rating - 5 star at CodeChef and Specialist at Codeforces).
"""
import sys
import bisect
import heapq
# from math import *
from collections import defaultdict as dd  # defaultdict(<datatype>) Free of KeyError.
from collections import deque  # deque(list) append(), appendleft(), pop(), popleft() - O(1)
from collections import Counter as c  # Counter(list)  return a dict with {key: count}
from itertools import combinations as comb
from bisect import bisect_left as bl, bisect_right as br, bisect
# sys.setrecursionlimit(2*pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()

def out(var): sys.stdout.write(var)

def l(): return list(map(int, data().split()))

def sl(): return list(map(str, data().split()))

def sp(): return map(int, data().split())

def ssp(): return map(str, data().split())

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

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

def fact(n):
    if n <= 1:
        dp[n] = 1
        return dp[n]
    if n in dp.keys():
        return dp[n]
    dp[n] = (n * fact(n-1)) % mod2
    return dp[n] % mod2

dp = dict()
inv = dict()
inv[1] = 1
for i in range(1, 200001):
    dp[i] = fact(i)
    inv[i] = pow(dp[i], mod2-2, mod2)

n, m = sp()
if n == 2:
    out("0")
    exit()
if m < n-1:
    out("0")
    exit()
power = (pow(2, n-3, mod2) * (n-2)) % mod2
mul = (dp[m] * inv[n-1] * inv[m-n+1]) % mod2
out(str((mul * power) % mod2))

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)

n,m=[int(x) for x in input().split()]

#observation: repeated element cannot be max element.
#1 of the repeated element has to be on the left, and the other
#on the right.
#This is equivalent to choosing n-1 distinct elements,
#then counting the #ways to pick left elements on left of max element, and choosing 1 left element to be repeated on the right.

MOD=998244353
MAX=m
fact=[1]
for zz in range(1,MAX+1):
    fact.append(((fact[-1]%MOD)*zz%MOD)%MOD) #with MOD
def nCr(n,r): #choose, MOD is prime
    num=fact[n]
    den=((fact[r]%MOD)*(fact[n-r]%MOD))%MOD #with MOD
    return ((num%MOD)*pow(den,MOD-2,MOD))%MOD #with MOD

#number of ways to choose n elements
nWaysChooseElements=nCr(m,n-1)

#number of ways to have left elements on the left of the max chosen element
nWaysLeftElements=0
for left in range(1,n-1):
    nWaysLeftElements+=(nCr(n-2,left)*left)%MOD #left ways to pick the repeated element
    nWaysLeftElements%=MOD
ans=nWaysLeftElements*nWaysChooseElements
ans%=MOD
print(ans)

import sys
input = sys.stdin.readline
n, m = map(int, input().split())
mod = 998244353
def euclidean(x, y):
    # assumes x, y != 0
    # Finding gcd and awins, b such that ax+by = gcd(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)

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)

def ncr(n, r, p):
    # initialize numerator
    # and denominator
    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
n,m=map(int,input().split())
if n>2:
    ans=ncr(m,n-1,mod)
    ans=ans*(n-2)
    ans=ans%mod
    ans=ans*pow(2,n-3,mod)
    ans=ans%mod
    print(ans)
else:
    ans=m%mod
    print(0)

def nCr(m, n):
    prod, prod1, prod2 = 1, 1, 1
    for i in range(2, m+1):
        prod*=i
        if(i==n):
            prod1=prod
        elif(i==m-n):
            prod2=prod
    return(prod//(prod1*prod2))
[n, m]=list(map(int, input().split()))
ans=(nCr(m, n-1)*(n-2)*(2**(n-3)))
print(ans%998244353)

#!/usr/bin/env python3

import sys
from math import *
from collections import defaultdict
from queue import deque                # Queues
from heapq import heappush, heappop    # Priority Queues
M = 998244353
invcache = {}

# parse
lines = [line.strip() for line in sys.stdin.readlines()]
n, m = list(map(int, lines[0].split()))

# precompute
facts = [1]
pows = [1]
for i in range(1, m+1):
  facts += [facts[-1] * i % M]
  pows += [pows[-1] * 2 % M]

# mod inv
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:
    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 operator as op
from functools import reduce
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

if __name__ == '__main__':

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

    res = C(m, n - 1)
    res *= (n - 2) *  (2 ** (n - 3) )
    print (res % p)

def power(a, n, mod):
  bi=str(format(n,"b")) #2進数
  res=1
  for i in range(len(bi)):
    res=(res*res) %mod
    if bi[i]=="1":
      res=(res*a) %mod
  return res

def cmb1(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

mod = 998244353 #出力の制限
N = 10**6
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 )

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

for i in range(n-1, m+1):
    ans += cmb1(i-1, n-2, mod)*(n-2)*power(2, n-3, mod)
    ans %= mod
ans %= mod
print(ans)

def power(a, n, mod):
  bi=str(format(n,"b")) #2進数
  res=1
  for i in range(len(bi)):
    res=(res*res) %mod
    if bi[i]=="1":
      res=(res*a) %mod
  return res

def cmb1(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

mod = 998244353 #出力の制限
N = 10**6
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 )

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

for i in range(n-1, m+1):
    ans += cmb1(i-1, n-2, mod)*(n-2)*power(2, n-3, mod)
    ans %= mod
ans %= 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(n)
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)

# -*- coding: utf-8 -*-
"""
Created on Tue Jul  7 16:08:14 2020

@author: Dell
"""

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

#print(math.factorial(m)//(math.factorial(n-1)*math.factorial(m-n+1)))
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(m*(m-1))

# -*- coding: utf-8 -*-
"""
Created on Tue Jul  7 16:08:14 2020

@author: Dell
"""

n,m=list(map(int,input().split()))
mod=998244353
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(math.factorial(m)//(math.factorial(n-1)*math.factorial(m-n+1)))
print(((pow(2,n-3))*(n-2)*p)%mod)

#from bisect import bisect_left as bl                #c++ lowerbound bl(array,element)
#from bisect import bisect_right as br               #c++ upperbound br(array,element)
#from __future__ import print_function, division    #while using python2

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():
    #sys.stdin = open('input.txt', 'r')
    #sys.stdout = open('output.txt', 'w')

    n, m = [int(x) for x in input().split()]

    mod = 998244353
    k = ncr(m, n-1, mod) % mod
    # print(k)
    if n > 2:
        k = (k * (n-2))%mod
        for i in range(n-3):
            k = (k * 2) % mod
    else:
        pass
    print(k)

#------------------ Python 2 and 3 footer by Pajenegod and c1729-----------------------------------------
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')

if __name__ == '__main__':
   main()

#from bisect import bisect_left as bl                #c++ lowerbound bl(array,element)
#from bisect import bisect_right as br               #c++ upperbound br(array,element)
#from __future__ import print_function, division    #while using python2

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():
    #sys.stdin = open('input.txt', 'r')
    #sys.stdout = open('output.txt', 'w')

    n, m = [int(x) for x in input().split()]

    if m == 2:
        print(0)
        return

    mod = 998244353
    k = ncr(m, n-1, mod) % mod
    # print(k)
    if n > 2:
        k = (k * (n-2))%mod
        for i in range(n-3):
            k = (k * 2) % mod
    else:
        pass
    print(k)

#------------------ Python 2 and 3 footer by Pajenegod and c1729-----------------------------------------
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')

if __name__ == '__main__':
   main()

import math
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
a,b=list(map(int,input().split()))
mod=998244353
res=1
for i in range(1,b+1):
    res=res*i%mod
for i in range(1,a):
    res=res//i%mod
for i in range(1,b-a+2):
    res=res//i%mod
ina=res%998244353
ina=ina*pow(1,mod-2)%mod*(a-2)%mod
ina=ina*pow(2,a-3)%mod
print(ina)

import math
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
a,b=list(map(int,input().split()))
mod=998244353
def powmod(num1,num2):
    res=1
    num1%=mod
    while num2:
        print(num2)
        if num2&1:
            res=res*num1%mod
            num1=num1*num1%mod
        num2>>=1
    return res

res=(math.factorial(b)//((math.factorial(a-1))*math.factorial(b-a+1)%mod))%mod
res=res*(a-2)%mod
res=res*(2**(a-3))%mod

print(res)

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(ans % MOD)

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((m*(m-1))%mod)

import math
import operator as op
from functools import reduce

N = 1000001
factorialNumInverse = [None] * (N + 1)
naturalNumInverse = [None] * (N + 1)
fact = [None] * (N + 1)
def InverseofNumber(p):
    naturalNumInverse[0] = naturalNumInverse[1] = 1
    for i in range(2, N + 1, 1):
        naturalNumInverse[i] = (naturalNumInverse[p % i] *
                                (p - int(p / i)) % p)

def InverseofFactorial(p):
    factorialNumInverse[0] = factorialNumInverse[1] = 1

    # precompute inverse of natural numbers
    for i in range(2, N + 1, 1):
        factorialNumInverse[i] = (naturalNumInverse[i] *
                                  factorialNumInverse[i - 1]) % p

def factorial(p):
    fact[0] = 1

    # precompute factorials
    for i in range(1, N + 1):
        fact[i] = (fact[i - 1] * i) % p

def Binomial(N, R, p):
    # n C r = n!*inverse(r!)*inverse((n-r)!)
    ans = ((fact[N] * factorialNumInverse[R]) % p *
           factorialNumInverse[N - R]) % p
    return ans

def power(x, y):
    if (y == 0):
        return 1
    elif (int(y % 2) == 0):
        return (power(x, int(y / 2)) *
                power(x, int(y / 2)))
    else:
        return (x * power(x, int(y / 2)) *
                power(x, int(y / 2)))
p = 998244353
InverseofNumber(p)
InverseofFactorial(p)
factorial(p)

a, b = map(int, input().split())
if a==2:
    print(b)
else:
    m = Binomial(b, (a - 1), p)
    m = (m * (a - 2)) % 998244353
    q = int(power(2, (a - 3))) % 998244353
    print((m * q) % 998244353)

def ncr(n, r, p):
    # initialize numerator
    # and denominator
    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
n,m=map(int,input().split())
if n>2:
    ans=ncr(m,n-1,mod)
    ans=ans*(n-2)
    ans=ans%mod
    ans=ans*pow(2,n-3,mod)
    ans=ans%mod
    print(ans)
else:
    ans=m%mod
    print(ans)

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()
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)

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(1e9)+7
inf = float("inf")

def ncr(n, r, p):
    # initialize numerator
    # and denominator
    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(m)
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 math, collections, sys
input = sys.stdin.readline
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())
mod = 998244353
if n == 2:
    ans = (m*(m-1)*2)%mod
    print(ans)
else:
    ans = ncr(m, n-1, mod)
    ans*=(n-2)
    ans%=mod
    ans*=pow(2, n-3, mod)
    ans%=mod
    print(ans)

import math, collections, sys
input = sys.stdin.readline
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())
mod = 998244353
if n == 2:
    ans = (m*(m-1))%mod
    print(ans)
else:
    ans = ncr(m, n-1, mod)
    ans*=(n-2)
    ans%=mod
    ans*=pow(2, n-3, mod)
    ans%=mod
    print(ans)

import math, collections, sys
input = sys.stdin.readline
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())
mod = 998244353
if n == 2:
    ans = pow(m, 2, mod)
    print(ans)
else:
    ans = ncr(m, n-1, mod)
    ans*=(n-2)
    ans%=mod
    ans*=pow(2, n-3, mod)
    ans%=mod
    print(ans)

import sys
input = sys.stdin.readline

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

if n == 2:
    print(m*(m-1))
    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)

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

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

import sys

input = sys.stdin.readline

def main():
    MOD = 998244353
    N, M = [int(x) for x in input().split()]

    if N == 2:
        print(M)
        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)

if __name__ == '__main__':
    main()

mod = 998244353
fact = [1]
for i in range(1, 2*(10**5) + 1):
	fact.append((i*fact[-1])%mod)
inv = []
for i in fact:
	inv.append(pow(i, mod - 2, mod))

def comb(a, b):
	return (((fact[a]*inv[a-b])%mod)*inv[b])%mod

n, m = map(int, raw_input().split())
print (((n-2)*(pow(2, n - 2, mod))*comb(m, n - 1))%mod)*inv[2]

f=[1 for j in range(200050)]
gf=[1 for j in range(200050)]
mod=998244353
for i in range(1,1050):
    f[i]=((f[i-1]*i)%mod)
    gf[i]=(pow(f[i],mod-2,mod))

def bc(n,p):
    j=f[n]*gf[p]
    j%=mod;j*=gf[n-p];j%=mod
    return j
n,m=map(int,raw_input().split())
s=0

g=(bc(m,n-1)*(n-2))%mod
v=pow(2,n-3,mod)
print (g*v)%mod

f=[1 for j in range(200055)]
gf=[1 for j in range(200055)]
mod=998244353
for i in range(1,200050):
    f[i]=((f[i-1]*i)%mod)
    gf[i]=(pow(f[i],mod-2,mod))

def bc(n,p):
    j=f[n]*gf[p]
    j%=mod;j*=gf[n-p];j%=mod
    return j
n,m=map(int,raw_input().split())
s=0
if n==2:
    print m
else:
    g=(bc(m,n-1)*(n-2))%mod
    v=pow(2,n-3,mod)
    print (g*v)%mod

f=[1 for j in range(201155)]
gf=[1 for j in range(201155)]
mod=998244353
for i in range(1,201150):
    f[i]=((f[i-1]*i)%mod)
    gf[i]=(pow(f[i],mod-2,mod))

def bc(n,p):
    j=f[n]*gf[p]
    if n>=len(f) or p<=len(gf):
        print 0
    j%=mod;j*=gf[n-p];j%=mod
    return j
n,m=map(int,raw_input().split())

g=(bc(m,n-1)*(n-2))%mod
v=pow(2,n-3,mod)
print (g*v)%mod

f=[1 for j in range(200050)]
gf=[1 for j in range(200050)]
mod=998244353
for i in range(1,1050):
    f[i]=((f[i-1]*i)%mod)
    gf[i]=(pow(f[i],mod-2,mod))

def bc(n,p):
    j=f[n]*gf[p]
    j%=mod;j*=gf[n-p];j%=mod
    return j
n,m=map(int,raw_input().split())
s=0

g=(bc(m,n-1)*(n-2))%mod
v=pow(2,n-3,mod-2)
print (g*v)%mod

f=[1 for j in range(200050)]
gf=[1 for j in range(200050)]
mod=998244353
for i in range(1,1050):
    f[i]=((f[i-1]*i)%mod)
    gf[i]=(pow(f[i],mod-2,mod))

def bc(n,p):
    j=f[n]*gf[p]
    j%=mod;j*=gf[n-p];j%=mod
    return j
n,m=map(int,raw_input().split())
s=0

g=(bc(2*m+n-1,n-1)*(n-1))%mod
v=pow(2,n-3,mod-2)
print (g*v)%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 - 1 < n or n == 2:
    print(0)
    exit(0)

c = 1
mod = 998244353
sum = 0

for maxx in range(n - 1, m + 1):
    sum += c
    #sum = sum % mod;
    c = (c * maxx * get_inverse(maxx - (n-2), mod)) % mod

#print(sum % mod)
sum = sum * (n - 2) % mod
for i in range(0, n-3):
    sum *= 2
    sum = sum % mod

print(sum % mod)

from sys import stdin,stdout
import sys
sys.setrecursionlimit(2*(10**5 + 100))

mod=998244353

maxn=2*10**5 + 100

factmod=[1]
invmod=[0]
invfactmod=[1]

for i in range(1,maxn):
	factmod.append((i*factmod[-1])%mod)
	invmod.append(pow(i,mod-2,mod))
	invfactmod.append((invmod[-1]*invfactmod[-1])%mod)

# print(factmod)
# print(invfactmod)
# print(invmod)

def ncr(n,r):
	return (((factmod[n]*invfactmod[r])%mod)*invfactmod[n-r])%mod

# stdin = open("input.txt", "r");
# stdout = open("output.txt", "w");

n,m=stdin.readline().strip().split(' ')
n,m=int(n),int(m)

if n==2:
	ans=0
else:

	ans=0
	for x in range(n-1,m+1):
		ans=(ans+(ncr(x-1,n-2)*(n-2)*pow(2,n-3,mod)))%mod

	stdout.write(str(ans%mod)+"\n")

#Code by Sounak, IIESTS
#------------------------------warmup----------------------------

import os
import sys
import math
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")

#-------------------game starts now-----------------------------------------------------
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

m=mod=998244353

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

fact=[0 for i in range(10**6 + 5)]
fact[0]=fact[1]=1
for i in range(2,len(fact)):
    fact[i] = i*fact[i-1]
    fact[i]%=m

# print(fact[:100])

invfact=[0 for i in range(10**6 + 5)]
invfact[len(fact) -1 ] = mpow(fact[len(fact)-1],m-2)

for i in range(len(invfact)-2,-1,-1):
    invfact[i] = ((i+1)*(invfact[i+1]))%m

# print(invfact[:100])
def comb(m,n):
    ans=(fact[m]*invfact[n]*invfact[m-n])
    # ans*=invfact[n]
    ans=ans%mod
    return ans

n,m=[int(c) for c in input().split()]

if n == 2:
    ans = comb(m,2)*2
    ans%=mod
    ans+=m
    ans%=mod
else:
    ans=comb(m,n-1)
    ans%=mod
    ans*=(n-2)
    ans%=mod
    ans*=(1<<(n-3))
    ans%=mod
print(ans)

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())
ans=(fact[m]*modinv(fact[n-1],mod)*modinv(fact[m-n+1],mod))%mod
ans=ans*(n-2)
ans=ans%mod
s=0
for i in range((n-3)//2+1):
    a=fact[n-3]
    b=modinv(fact[i],mod)
    c=modinv(fact[n-3-i],mod)
    s+=(a*b*c)%mod
if s==1:
    ans=(ans*s)%mod
else:
    ans=(ans*2*s)%mod
print(ans%mod)