import java.io.*;
import java.util.*;

public class TestClass {

	static PrintWriter out = new PrintWriter(System.out);
	public static void main(String[] args) throws IOException{

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s[] = in.readLine().split(" ");
		int n = Integer.parseInt(s[0]);
		int m = Integer.parseInt(s[1]);
		long mod = 998244353;
		long ans = (n-2)%mod;
		ans = (ans * power(2,n-3,mod))%mod;
		ans = (ans*ncr(m,n-1,mod)%mod);
		out.println(ans);
        out.close();
	}
	public static long power(long a,long b,long c)
	{
		long ans = 1;
		while(b!=0)
		{
			if(b%2==1)
			{
				ans = ans*a;
				ans = ans % c;
			}
			a = a*a;
			a = a%c;
			b = b/2;
		}
		return ans;
	}
	public static long ncr(int n,int k,long mod)
    {
    	long ans = (fact_inversemod(k,mod)*fact_inversemod(n-k,mod))%mod;
    	ans = (fact(n,mod)*ans)%mod;
    	return ans;
    }
	public static long fact(int n, long mod)
	{
		long ans = 1;
	    for(int i=2;i<=n;i++)
	    {
	        ans = (i*ans)%mod;
	    }
	    return ans;
	}
	public static long fact_inversemod(int n, long mod)   //f1[n] = 1/n! and not n!
	{
	   long ans = 1;
	    for(int i=2;i<=n;i++)
	    {
	    	long temp = power(i,mod-2,mod);      //(1/i)%mod
	        ans = (temp*ans)%mod;
	    }
	    return ans;
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
public class EdC {

	public static void main(String[] args) throws Exception{
		int num = 998244353;
		long[] fact = new long[200001];
 		fact[0] = 1;
 		long ans1 = 1;
 		for(int i = 1;i<=200000;i++){
 			ans1= (ans1*i) % num;
 			fact[i] = ans1;
 		}
 		long[] inv = new long[200001];
 		inv[0] = 1;
 		for(int i = 1;i<=200000;i++){
 			inv[i] = power(fact[i], num-2, num)%num;
 		}
		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		int n = Integer.parseInt(st.nextToken());
 		int m = Integer.parseInt(st.nextToken());
 		if (n == 2)
 			out.println(0);
 		else{
	 		long ans = (fact[m]*inv[n-1])%num;
	 		ans*=inv[m-n+1];
	 		ans%=num;
	 		ans*=power((long)(2), n-3, num);
	 		ans%= num;
	 		ans*= (n-2);
	 		ans%= num;
	 		out.println(ans);
 		}
 		out.close();

 	}
	public static int power(long x, long y, long mod){
		long ans = 1;
		while(y>0){
			if (y%2==1)
				ans = (ans*x)%mod;
			x = (x*x)%mod;
			y/=2;
		}
		return (int)(ans);
	}
}

//StringJoiner sj = new StringJoiner(" ");
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

import java.util.*;

public class Main {

    // global
    static long fact[];
    static long inverse[];
    static long mod = 998244353;

    static long pow(long a,long n) {
        long res=1;
        while (n>0) {
            if ((n-n/2*2)==1) {
                res=res*a%mod;
            }
            a=a*a%mod;
            n>>=1;
        }
        return res;
    }

    static long modinv(long n) {
        return pow(n, mod-2);
    }

    static long comb(int n,int k){
        if(n<0 || k<0 || n<k)return 0;
        return fact[n]*(inverse[k]*inverse[n-k]%mod) %mod;
    }

    public static void main(String[] args) {
        // main method
        fact=new long[500000];
        fact[0]=1;
        inverse=new long[500000];
        inverse[0]=1;
        for(int i=1;i<500000;i++){
            fact[i]=(fact[i-1]*(long)i)%mod;
            inverse[i]=modinv(fact[i]);
        }

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        // long ans = 0L;
        // for (int j=1;j<=n-1;j++) {
        //     for (int i=n-1;i<=m;i++) {
        //         ans = (ans+((long)(i-1)*comb(i-2, n-3)%mod)*comb(n-3, j-1)%mod)%mod;
        //     }
        // }
        long sum = 0L;
        for (int i=n-1;i<=m;i++) {
            sum = (sum+(long)(i-1)*comb(i-2, n-3)%mod)%mod;
        }
        long sum_sum = 0L;
        for (int j=1;j<=n-1;j++) {
            sum_sum = (sum_sum+sum*comb(n-3, j-1)%mod)%mod;
        }
        System.out.println(sum_sum);
    }
}

import java.io.*;
import java.util.*;

public class GFG {
	private static int MOD=998244353;
	private static long ncr(int n,int r){
		long ans=1;
		for(int i=1;i<=r;i++)
			ans=((ans*(n-r+i))%MOD*pow(i,MOD-2))%MOD;
		return ans;
	}
	private static long pow(long n,long k){
		long x=1,y=n;
		while(k!=0){
			if(k%2==1){
				x=x*y;
				x%=MOD;
			}
			y=y*y;
			y%=MOD;
			k=k/2;
		}
		return x;
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//int t = Integer.parseInt(br.readLine().trim());
		//while (t-- != 0) {
			String s = br.readLine().trim();
			String ss[]=s.split("\\s+");
			int n=Integer.parseInt(ss[0]);
			int m=Integer.parseInt(ss[1]);
			long ans=0;
			if(n>2){
    			ans=ncr(m,n-1);
    			ans=(ans*(n-2))%MOD;
    			ans=(ans*pow(2,n-3))%MOD;
			}
			System.out.println(ans);
		//}
	}
}

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Created by gouthamvidyapradhan on 11/07/2020
 */
public class CountTheArrays {
    private static PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out, 500000));
    static class MyScanner {
        /**
         * Buffered reader
         */
        private static BufferedReader br = new BufferedReader(
                new InputStreamReader(System.in));

        private static StringTokenizer st;

        /**
         * Read integer
         *
         * @return
         * @throws Exception
         */
        public static int readInt() throws Exception {
            try {
                if (st != null && st.hasMoreTokens()) {
                    return parseInt(st.nextToken());
                }
                String str = br.readLine();
                if(str == null) return -2;
                if (!str.trim().equals("")) {
                    st = new StringTokenizer(str);
                    return parseInt(st.nextToken());
                }
            } catch (IOException e) {
                close();
                return -1;
            }
            return -1;
        }

        /**
         * Read integer
         *
         * @return
         * @throws Exception
         */
        public static long readLong() throws Exception {
            try {
                if (st != null && st.hasMoreTokens()) {
                    return Long.parseLong(st.nextToken());
                }
                String str = br.readLine();
                if (str != null && !str.trim().equals("")) {
                    st = new StringTokenizer(str);
                    return Long.parseLong(st.nextToken());
                }
            } catch (IOException e) {
                close();
                return -1;
            }
            return -1;
        }

        /**
         * Read line
         * @return
         * @throws Exception
         */
        public static String readLine() throws Exception
        {
            return br.readLine();
        }

        /**
         * Parse to integer
         * @param in
         * @return integer value
         */
        public static int parseInt(String in)
        {
            // Check for a sign.
            int num  = 0, sign = -1, i = 0;
            final int len  = in.length( );
            final char ch  = in.charAt( 0 );
            if ( ch == '-' )
                sign = 1;
            else
                num = '0' - ch;

            // Build the number.
            i+=1;
            while ( i < len )
                num = num*10 + '0' - in.charAt( i++ );
            return sign * num;
        }

        /**
         * Close BufferedReader
         *
         * @throws Exception
         */
        public static void close() throws Exception {
            br.close();
        }
    }

    private static long[] F;
    private static long[] P;
    private static final int MOD = 998244353;
    public static void main(String[] args) throws Exception{
        int n = MyScanner.readInt();
        int m = MyScanner.readInt();
        if(n < 3) {
            pw.println(0);
        } else{
            F = new long[(Math.max(m, n)) + 1];
            P = new long[n + 1];
            Arrays.fill(F, -1);
            Arrays.fill(P, -1);
            long ans = 0L;
            for(int i = 1; i < m; i ++){
                long ncR = NcR(i - 1, n - 3);
                long pow = power(n - 3);
                ans = ((ans + (((ncR * pow % MOD) * i) % MOD)) % MOD);
            }
            pw.println(ans);
        }
        pw.flush();
        pw.close();
    }

    private static long power(int n){
        if(n == 0) return 1;
        else if(P[n] != -1) return P[n];
        long res = ((power(n - 1) * 2) % MOD);
        P[n] = res;
        return res;
    }

    private static long NcR(int n, int r){
        if(n - r < 0) return 0;
        return ((fact(n) * ((modInverse((int)fact(r)) * modInverse((int)fact(n - r))) % MOD)) % MOD);
    }
    private static long fact(int n){
        if(n == 0 || n == 1) return 1;
        else if(F[n] != -1) return F[n];
        else {
            F[n] = ((n * (fact(n - 1) % MOD)) % MOD);
            return F[n];
        }
    }

    private static int modMul(int a, int b){
        return (int)(((long) a * b) % MOD);
    }

    private static int modAdd(int a, int b){
        return (int)(((long) a + b) % MOD);
    }

    private static long modInverse(int a){
        ExtendedGcd gcdPair = new ExtendedGcd();;
        gcd(a, MOD, gcdPair);
        return (((gcdPair.x % MOD) + MOD) % MOD);
    }

    static class ExtendedGcd{
        long x, y;
    }

    private static long gcd(long a, long b, ExtendedGcd gcdPair){
        if(b == 0) {
            gcdPair.x = 1;
            gcdPair.y = 0;
            return a;
        }
        ExtendedGcd newGcdPair = new ExtendedGcd();
        long r = gcd(b, a % b, newGcdPair);
        gcdPair.x = newGcdPair.y;
        gcdPair.y = newGcdPair.x - newGcdPair.y * (a/b);
        return r;
    }
}

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Created by gouthamvidyapradhan on 11/07/2020
 */
public class CountTheArrays {
    private static PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out, 500000));
    static class MyScanner {
        /**
         * Buffered reader
         */
        private static BufferedReader br = new BufferedReader(
                new InputStreamReader(System.in));

        private static StringTokenizer st;

        /**
         * Read integer
         *
         * @return
         * @throws Exception
         */
        public static int readInt() throws Exception {
            try {
                if (st != null && st.hasMoreTokens()) {
                    return parseInt(st.nextToken());
                }
                String str = br.readLine();
                if(str == null) return -2;
                if (!str.trim().equals("")) {
                    st = new StringTokenizer(str);
                    return parseInt(st.nextToken());
                }
            } catch (IOException e) {
                close();
                return -1;
            }
            return -1;
        }

        /**
         * Read integer
         *
         * @return
         * @throws Exception
         */
        public static long readLong() throws Exception {
            try {
                if (st != null && st.hasMoreTokens()) {
                    return Long.parseLong(st.nextToken());
                }
                String str = br.readLine();
                if (str != null && !str.trim().equals("")) {
                    st = new StringTokenizer(str);
                    return Long.parseLong(st.nextToken());
                }
            } catch (IOException e) {
                close();
                return -1;
            }
            return -1;
        }

        /**
         * Read line
         * @return
         * @throws Exception
         */
        public static String readLine() throws Exception
        {
            return br.readLine();
        }

        /**
         * Parse to integer
         * @param in
         * @return integer value
         */
        public static int parseInt(String in)
        {
            // Check for a sign.
            int num  = 0, sign = -1, i = 0;
            final int len  = in.length( );
            final char ch  = in.charAt( 0 );
            if ( ch == '-' )
                sign = 1;
            else
                num = '0' - ch;

            // Build the number.
            i+=1;
            while ( i < len )
                num = num*10 + '0' - in.charAt( i++ );
            return sign * num;
        }

        /**
         * Close BufferedReader
         *
         * @throws Exception
         */
        public static void close() throws Exception {
            br.close();
        }
    }

    private static long[] F;
    private static long[] P;
    private static final int MOD = 998244353;
    public static void main(String[] args) throws Exception{
        int n = MyScanner.readInt();
        int m = MyScanner.readInt();
        if(n < 3) {
            pw.println(0);
        } else{
            F = new long[(Math.max(m, n)) + 1];
            P = new long[n + 1];
            Arrays.fill(F, -1);
            Arrays.fill(P, -1);
            long ans = 0L;
            for(int i = 1; i < m; i ++){
                long ncR = NcR(i - 1, n - 3);
                long pow = power(n - 3);
                ans = ((ans + (((ncR * pow % MOD) * i) % MOD)) % MOD);
            }
            pw.println(ans);
        }
        pw.flush();
        pw.close();
    }

    private static long power(int n){
        if(n == 0) return 1;
        if(n == 1) return 2;
        else if(P[n] != -1) return P[n];
        long res = (((power(n / 2) % MOD) * (power(n - (n / 2)) % MOD)) % MOD);
        P[n] = res;
        return res;
    }

    private static long NcR(int n, int r){
        if(n - r < 0) return 0;
        return ((fact(n) * ((modInverse((int)fact(r)) * modInverse((int)fact(n - r))) % MOD)) % MOD);
    }
    private static long fact(int n){
        if(n == 0 || n == 1) return 1;
        else if(F[n] != -1) return F[n];
        else {
            F[n] = ((n * (fact(n - 1) % MOD)) % MOD);
            return F[n];
        }
    }

    private static int modMul(int a, int b){
        return (int)(((long) a * b) % MOD);
    }

    private static int modAdd(int a, int b){
        return (int)(((long) a + b) % MOD);
    }

    private static long modInverse(int a){
        ExtendedGcd gcdPair = new ExtendedGcd();;
        gcd(a, MOD, gcdPair);
        return (((gcdPair.x % MOD) + MOD) % MOD);
    }

    static class ExtendedGcd{
        long x, y;
    }

    private static long gcd(long a, long b, ExtendedGcd gcdPair){
        if(b == 0) {
            gcdPair.x = 1;
            gcdPair.y = 0;
            return a;
        }
        ExtendedGcd newGcdPair = new ExtendedGcd();
        long r = gcd(b, a % b, newGcdPair);
        gcdPair.x = newGcdPair.y;
        gcdPair.y = newGcdPair.x - newGcdPair.y * (a/b);
        return r;
    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Random;
import java.io.FileWriter;
import java.io.PrintWriter;
/*
    Solution Created: 20:28:14 09/03/2020
    Custom Competitive programming helper.
*/
public class Main {
	static long MOD = 998244353;
	static long[] fact = new long[300000];

	public static void solve(Reader in, Writer out) {
		fact[0] = 1;
		fact[1] = 1;
		for (int i = 2; i < 300000; i++) fact[i] = (fact[i - 1] * i) % MOD;
		int n = in.nextInt(), m = in.nextInt();
		long ans = nCr(m, n-1);
		ans%=MOD;
		ans*=power(2, n-3, MOD);
		ans%=MOD;
		ans*=(n-2);
		ans%=MOD;
		out.println(ans);
	}

	static long nCr2(int n, int r) {
		if (n < 0)
			return 0;
		if (r < 0)
			return 0;
		return Util.modDiv(fact[n], Util.modMul(fact[r], fact[n - r], MOD), MOD);
	}

	static long nCr(long n, long r) {
		long p = MOD;
		if (r == 0) return 1;
		return (fact[(int) n] * modInverse(fact[(int) r], p) % p * modInverse(fact[(int) (n - r)], p) % p) % p;
	}

	static long modInverse(long n, long p) {
		return power(n, p - 2, p);
	}

	static long power(long x, long y, long p) {
		long res = 1;
		x = x % p;
		while (y > 0) {
			if (y % 2 == 1)
				res = (res * x) % p;
			y = y >> 1; // y = y/2
			x = (x * x) % p;
		}
		return res;
	}

	public static void main(String[] args) {
		Reader in = new Reader();
		Writer out = new Writer();
		solve(in, out);
		out.exit();
	}

static class Graph {
	private ArrayList<Integer> con[];
	private boolean[] visited;

	public Graph(int n) {
		con = new ArrayList[n];
		for (int i = 0; i < n; ++i)
			con[i] = new ArrayList();
		visited = new boolean[n];
	}

	public void reset() {
		Arrays.fill(visited, false);
	}

	public void addEdge(int v, int w) {
		con[v].add(w);
	}

	public void dfs(int cur) {
		visited[cur] = true;
		for (Integer v : con[cur]) {
			if (!visited[v]) {
				dfs(v);
			}
		}
	}

	public void bfs(int cur) {
		Queue<Integer> q = new LinkedList<>();
		q.add(cur);
		visited[cur] = true;
		while (!q.isEmpty()) {
			cur = q.poll();
			for (Integer v : con[cur]) {
				if (!visited[v]) {
					visited[v] = true;
					q.add(v);
				}
			}
		}
	}
}

static class Reader {
	static BufferedReader br;
	static StringTokenizer st;
	private int charIdx = 0;
	private String s;

	public Reader() {
		this.br = new BufferedReader(new InputStreamReader(System.in));
	}

	public Reader(String f){
		try {
			this.br = new BufferedReader(new FileReader(f));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public double[] nd(int n) {
		double[] a = new double[n];
		for (int i = 0; i < n; i++)
			a[i] = nextDouble();
		return a;
	}

	public char nextChar() {
		if (s == null || charIdx >= s.length()) {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			s = st.nextToken();
			charIdx = 0;
		}
		return s.charAt(charIdx++);
	}

	public long[] nl(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}

	public char[] nca() {
		return next().toCharArray();
	}

	public String[] nS(int n) {
		String[] a = new String[n];
		for (int i = 0; i < n; i++)
			a[i] = next();
		return a;
	}

	public int nextInt() {
		if (st == null || !st.hasMoreTokens())
			try {
				readLine();
			} catch (Exception e) {
			}
		return Integer.parseInt(st.nextToken());
	}

	public double nextDouble() {
		if (st == null || !st.hasMoreTokens())
			try {
				readLine();
			} catch (Exception e) {
			}
		return Double.parseDouble(st.nextToken());
	}

	public Long nextLong() {
		if (st == null || !st.hasMoreTokens())
			try {
				readLine();
			} catch (Exception e) {
			}
		return Long.parseLong(st.nextToken());
	}

	public String next() {
		if (st == null || !st.hasMoreTokens())
			try {
				readLine();
			} catch (Exception e) {
			}
		return st.nextToken();
	}

	public static void readLine() {
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
		}
	}
}
static class Solution {
	public static void solve(Reader in, Writer out) {

	}
}

static class Sort {
	static Random random = new Random();
	public static void sortArray(int[] s) {
        shuffle(s);
        Arrays.sort(s);
    }
	public static void sortArray(long[] s) {
        shuffle(s);
        Arrays.sort(s);
    }
	public static void sortArray(String[] s) {
        shuffle(s);
        Arrays.sort(s);
    }
	public static void sortArray(char[] s) {
        shuffle(s);
        Arrays.sort(s);
    }
    private static void shuffle(int[] s) {
        for (int i = 0; i < s.length; ++i) {
            int j = random.nextInt(i + 1);
            int t = s[i];
            s[i] = s[j];
            s[j] = t;
        }
    }
    private static void shuffle(long[] s) {
        for (int i = 0; i < s.length; ++i) {
            int j = random.nextInt(i + 1);
            long t = s[i];
            s[i] = s[j];
            s[j] = t;
        }
    }
    private static void shuffle(String[] s) {
        for (int i = 0; i < s.length; ++i) {
            int j = random.nextInt(i + 1);
            String t = s[i];
            s[i] = s[j];
            s[j] = t;
        }
    }
    private static void shuffle(char[] s) {
        for (int i = 0; i < s.length; ++i) {
            int j = random.nextInt(i + 1);
            char t = s[i];
            s[i] = s[j];
            s[j] = t;
        }
    }
}

static class Util{
	    static boolean isPrime(int n) {
	        if (n <= 1) return false;
	        if (n <= 3) return true;
	        if (n % 2 == 0 || n % 3 == 0) return false;
	        for (int i = 5; i * i <= n; i = i + 6)
	            if (n % i == 0 || n % (i + 2) == 0)
	            return false;
	        return true;
	    }
		public static int upperBound(long[] a, long v) {
			int l=0, h=a.length-1, ans = -1;
			while(l<h) {
				int mid = (l+h)/2;
				if(a[mid]<=v) {
					ans = mid;
					l = mid+1;
				}else h = mid-1;
			}
			return ans;
		}
		public static int lowerBound(long[] a, long v) {
			int l=0, h=a.length-1, ans = -1;
			while(l<h) {
				int mid = (l+h)/2;
				if(v<=a[mid]) {
					ans = mid;
					h = mid-1;
				}else l = mid-1;
			}
			return ans;
		}
	    public static boolean[] getSieve(int n) {
	        boolean[] isPrime = new boolean[n+1];
	        for (int i = 2; i <= n; i++) isPrime[i] = true;
	        for (int i = 2; i*i <= n; i++) if (isPrime[i])
	                for (int j = i; i*j <= n; j++) isPrime[i*j] = false;
	        return isPrime;
	    }
	    public static int gcd(int a, int b) {
	        if (a == 0)
	            return b;
	        return gcd(b%a, a);
	    }
		public static long modAdd(long a, long b, long mod) {
			return (a%mod+b%mod)%mod;
		}
		public static long modMul(long a, long b, long mod) {
			return ((a%mod)*(b%mod))%mod;
		}
		public static long modDiv(long a, long b, long mod) {
			return ((a%mod)/(b%mod))%mod;
		}
		public static void dbg(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
	}

static class Writer {
	private PrintWriter pw;
	public Writer(){
		pw = new PrintWriter(System.out);
	}

	public Writer(String f){
		try {
			pw = new PrintWriter(new FileWriter(f));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void printArray(int[] a) {
		for(int i = 0; i<a.length; i++) print(a[i]+" ");
	}
	public void printlnArray(int[] a) {
		for(int i = 0; i<a.length; i++) print(a[i]+" ");
		pw.println();
	}
	public void printArray(long[] a) {
		for(int i = 0; i<a.length; i++) print(a[i]+" ");
	}
	public void printlnArray(long[] a) {
		for(int i = 0; i<a.length; i++) print(a[i]+" ");
		pw.println();
	}
	public void print(Object o) {
		pw.print(o.toString());
	}
	public void println(Object o) {
		pw.println(o.toString());
	}
	public void println() {
		pw.println();
	}
	public void flush() {
		pw.flush();
	}
	public void exit() {
		pw.close();
	}
}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author AnandOza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DCountTheArrays solver = new DCountTheArrays();
        solver.solve(1, in, out);
        out.close();
    }

    static class DCountTheArrays {
        NumberTheory.Mod998 mod = new NumberTheory.Mod998();

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();

            long answer = mod.mult(mod.ncr(m, n - 1), n - 2, mod.pow(2, n - 3));

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class NumberTheory {
        private static void ASSERT(boolean assertion) {
            if (!assertion)
                throw new AssertionError();
        }

        public abstract static class Modulus<M extends NumberTheory.Modulus<M>> {
            ArrayList<Long> factorial = new ArrayList<>();
            ArrayList<Long> invFactorial = new ArrayList<>();

            public abstract long modulus();

            public Modulus() {
                super();
                factorial.add(1L);
                invFactorial.add(1L);
            }

            public long fact(int n) {
                while (factorial.size() <= n) {
                    factorial.add(mult(factorial.get(factorial.size() - 1), factorial.size()));
                }

                return factorial.get(n);
            }

            public long fInv(int n) {
                int lastKnown = invFactorial.size() - 1;

                if (lastKnown < n) {
                    long[] fInv = new long[n - lastKnown];
                    fInv[0] = inv(fact(n));
                    for (int i = 1; i < fInv.length; i++) {
                        fInv[i] = mult(fInv[i - 1], n - i + 1);
                    }
                    for (int i = fInv.length - 1; i >= 0; i--) {
                        invFactorial.add(fInv[i]);
                    }
                }

                return invFactorial.get(n);
            }

            public long ncr(int n, int r) {
                ASSERT(n >= 0);
                if (r < 0 || n < r)
                    return 0;
                return mult(fact(n), mult(fInv(r), fInv(n - r)));
            }

            public long normalize(long x) {
                x %= modulus();
                if (x < 0)
                    x += modulus();
                return x;
            }

            public long mult(long... x) {
                long r = 1;
                for (long i : x)
                    r = mult(r, i);
                return r;
            }

            public long mult(long a, long b) {
                return (a * b) % modulus();
            }

            public long pow(long x, int e) {
                if (e < 0) {
                    x = inv(x);
                    e *= -1;
                }
                if (e == 0)
                    return 1;
                if ((e & 1) > 0)
                    return mult(x, pow(x, e - 1));
                return pow(mult(x, x), e / 2);
            }

            public long inv(long value) {
                long g = modulus(), x = 0, y = 1;
                for (long r = value; r != 0; ) {
                    long q = g / r;
                    g %= r;

                    long temp = g;
                    g = r;
                    r = temp;

                    x -= q * y;

                    temp = x;
                    x = y;
                    y = temp;
                }

                ASSERT(g == 1);
                ASSERT(y == modulus() || y == -modulus());

                return normalize(x);
            }

        }

        public static class Mod998 extends NumberTheory.Modulus<NumberTheory.Mod998> {
            public long modulus() {
                return 998_244_353L;
            }

        }

    }
}

/*
 * Remember a 6.72 student can know more than a 10.0 student.
 * Grades don't determine intelligence, they test obedience.
 * I Never Give Up.
 * I will become Candidate Master.
 * I will defeat Saurabh Anand.
 * Skills are Cheap,Passion is Priceless.
 */
import java.util.*;
import java.util.Map.Entry;
import java.io.*;

import static java.lang.System.out;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class ContestMain{
	private static Reader in=new Reader();
	private static StringBuilder ans=new StringBuilder();
	private static long MOD=(long)1e9+7;
	private static final int N=(int) (1e5+7); // 1e5+7
    private static ArrayList<Integer> v[]=new ArrayList[N];
	private static boolean mark[]=new boolean[N];
//    private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	private static void shuffle(long arr[]){
		for(int i=arr.length-1;i>=2;i--){
			int x=new Random().nextInt(i-1);
			long temp=arr[x];
			arr[x]=arr[i];
			arr[i]=temp;
		}
	}
	private static void shuffle(int arr[]){
		for(int i=arr.length-1;i>=2;i--){
			int x=new Random().nextInt(i-1);
			int temp=arr[x];
			arr[x]=arr[i];
			arr[i]=temp;
		}
	}
    private static long gcd(long a, long b){
        if(b==0)return a;
        return gcd(b,a%b);
    }
//    private static boolean check(int x,int y){
//        if((x>=0&&x<n)&&(y>=0&&y<m)&&mat[x][y]!='X'&&!visited[x][y])return true;
//        return false;
//    }

	public static void main(String[] args) throws IOException{
		int n=in.nextInt();
		int m=in.nextInt();
		if(n==2){pln(0);return;}
		long fact[]=new long[m+1];
		MOD=998244353;
		fact[0]=1;
		for(int i=1;i<=m;i++)
			fact[i]=mod(fact[i-1]*i,MOD);
		long d=mul(fact[m],modInv(mul(fact[m-n+1],fact[n-1])));
		d=mul(d,mul(n-2,powmod(2,n-3)));
		pln(d);
	}
	static class Pair<T> implements Comparable<Pair>{
		int l;
		int r;
		Pair(){
			l=0;
			r=0;
		}
		Pair(int k,int v){
			l=k;
			r=v;
		}
		@Override
		public int compareTo(Pair o){
			if(l!=o.l)return (int)(l-o.l);
			return (int)(r-o.r);
		}
		// Fenwick tree question comparator
//        @Override
//        public int compareTo(Pair o) {
//            if(o.r!=r)return (int) (r-o.r);
//            else return (int)(l-o.l);
//        }
	}
	//Modular operations
	private static long mod(long a,long b){
	    	return (b+a%b)%b;
	}
	private static long modInv(long a){
	    	return powmod(a,MOD-2);
	}
	private static long powmod(long x,long n){
		if(n==0||x==0)
			return 1;
		else if(n%2==0)
			return(powmod((x*x)%MOD,n/2));
		else
			return (x*(powmod((x*x)%MOD,(n-1)/2)))%MOD;
	}
	public static long mul(long a,long b){
		return mod(mod(a,MOD)*mod(b,MOD),MOD);
	}
	public static long add(long a,long b){
		return mod(mod(a,MOD)+mod(b,MOD),MOD);
	}
	//Reader Class
	static class Reader{
		BufferedReader br;
		StringTokenizer st;
		public Reader(){br=new BufferedReader(new InputStreamReader(System.in));}
		String next(){
			while(st==null||!st.hasMoreElements()){
				try{st=new StringTokenizer(br.readLine());
				}catch(IOException e){e.printStackTrace();}
			}
			return st.nextToken();
		}
		int nextInt(){return Integer.parseInt(next());}
		long nextLong(){return Long.parseLong(next());}
		double nextDouble(){return Double.parseDouble(next());}
		String nextLine(){
			String str="";
			try{
				str=br.readLine();
			}catch(IOException e){
				e.printStackTrace();
			}
			return str;
		}
	}
	//Looping methods
	static void rep(int ar[],int start,int end){
		for(int i=start;i<end;i++)
			ar[i]=in.nextInt();
	}
	static void rep(long ar[],int start,int end){
		for(int i=start;i<end;i++)
			ar[i]=in.nextLong();
	}
	static void rep(String ar[],int start,int end){
		for(int i=start;i<end;i++)
			ar[i]=in.next();
	}
	//Printer Methods
	static void pn(Object o){out.print(o);}
	static void pln(Object o){out.println(o);}
	static void pln(){out.println();}
	static void pf(String format,Object o){out.printf(format,o);}
	//Appenders
	static void app(Object o){ans.append(o);}
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 *
 * @author pttrung
 */
public class D_Edu_Round_83 {
    public static long MOD = 998244353;
    static long[] dp;

    public static void main(String[] args) throws FileNotFoundException {
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File(
        // "output.txt")));
        PrintWriter out = new PrintWriter(System.out);
        Scanner in = new Scanner();
        int n = in.nextInt();
        int m = in.nextInt();
        dp = new long[m + 1];
        dp[0] = 1;
        long TWO = 1;
        for (int i = 1; i < dp.length; i++) {
            dp[i] = (dp[i - 1] * i) % MOD;
        }
        for (int i = 1; i < n - 2; i++) {
            TWO *= 2;
            TWO %= MOD;
        }
        long result = 1;
        for (int i = n; i <= m; i++) {
            result *= i;
            result %= MOD;
        }
        result *= pow(dp[m - (n - 1)], MOD - 2);
        result %= MOD;
        result *= TWO;
        result %= MOD;
        result *= (n - 2);
        result %= MOD;
        //System.out.println(TWO);
        out.println(result);
        out.close();
    }

    public static int[] KMP(String val) {
        int i = 0;
        int j = -1;
        int[] result = new int[val.length() + 1];
        result[0] = -1;
        while (i < val.length()) {
            while (j >= 0 && val.charAt(j) != val.charAt(i)) {
                j = result[j];
            }
            j++;
            i++;
            result[i] = j;
        }
        return result;

    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;
    }

    public static int digit(long n) {
        int result = 0;
        while (n > 0) {
            n /= 10;
            result++;
        }
        return result;
    }

    public static double dist(long a, long b, long x, long y) {
        double val = (b - a) * (b - a) + (x - y) * (x - y);
        val = Math.sqrt(val);
        double other = x * x + a * a;
        other = Math.sqrt(other);
        return val + other;

    }

    public static class Point implements Comparable<Point> {

        int x, y;

        public Point(int start, int end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = 47 * hash + this.x;
            hash = 47 * hash + this.y;
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return Integer.compare(x, o.x);
        }
    }

    public static class FT {

        long[] data;

        FT(int n) {
            data = new long[n];
        }

        public void update(int index, long value) {
            while (index < data.length) {
                data[index] += value;
                index += (index & (-index));
            }
        }

        public long get(int index) {
            long result = 0;
            while (index > 0) {
                result += data[index];
                index -= (index & (-index));
            }
            return result;

        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static long pow(long a, long b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }

        long val = pow(a, b / 2);
        if (b % 2 == 0) {
            return (val * val) % MOD;
        } else {
            return (val * ((val * a) % MOD)) % MOD;

        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //  br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.util.Scanner;

public class CounttheArrays {

    static long m = 998244353;

    static long modInv(long a, long b) {
        long m = b;
        long x = 1, y = 0;
        while (a > 1) {
            long q = a / b;
            long p = b;
            b = a % b;
            a = p;
            p = y;
            y = x - q * y;
            x = p;
        }
        if (x < 0) {
            x += m;
        }

        return x;
    }

    static long nCr(long n, long r) {
        long res = 1;
        if (r > n - r) {
            r = n - r;
        }
        for (int i = 0; i < r; i++) {
            res = ((res % m) * ((n - i) % m)) % m;
            res = ((res % m) * (modInv((i + 1), m)) % m) % m;
        }
        return res % m;
    }

    static long pow(long a, long b) {
        long r = 1;
        while (b >= 1) {
            if (b % 2 == 1) {
                r = ((r % m) * (a % m)) % m;
                --b;
            }
            a = ((a % m) * (a % m)) % m;
            b = b / 2;
        }
        return r % m;
    }

    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        long n = scan.nextLong();
        long k = scan.nextLong();
        long ncr = nCr(k, n - 1);
        long res = ((ncr % m) * ((n - 2) % m) % m);
        res = ((res % m) * (pow(2, n - 3)) % m) % m;
        System.out.println(res);
    }

}

/**
 * BaZ :D
 */

import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main
{
    static MyScanner scan;
    static PrintWriter pw;
    static long MOD = 998244353;
    static long INF = 1_000_000_000_000_000_000L;
    static long inf = 2_000_000_000;
    public static void main(String[] args) {
        new Thread(null, null, "BaZ", 1 << 27) {
            public void run() {
                try {
                    solve();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }

    static long X,Y,GCD,res;
    static long fact[] = new long[1000001];
    static long invfact[] = new long[1000001];
    static long inv[] = new long[1000001];

    static void solve() throws IOException
    {
        //initIo(true, "");
        initIo(false, "");
        StringBuilder sb = new StringBuilder();
        fact[0] = fact[1] = inv[1] = invfact[0] = invfact[1] = 1;
        long q;
        int r;
        for(int i=2;i<=1000000;++i)
        {
            q = MOD/i;
            r = (int)MOD%i;
            inv[i] = (-(q*inv[r])%MOD+MOD)%MOD;
            fact[i] = (fact[i-1]*i)%MOD;
            invfact[i] = (invfact[i-1]*inv[i])%MOD;
        }

        int n = ni(), m = ni();
        if(n==2) {
            pl(0);
        }
        else {

//                    long ans = 0;
//                    for (int i = 1; i <= m; ++i) {
//                        for(int j=i+1;j<=m;++j) {
////                            for(int chosen=0;chosen<=n-3;++chosen) {
////                                ans+=nCr(j-2, chosen) * nCr(j-2-chosen, n-3-chosen);
////                                ans%=MOD;
////                            }
//                            ans+=nCr(j-2, n-3) * modpow(2, n-3, MOD);
//                            ans%=MOD;
//                        }
//
//
//
//            }

                    long ans = 0;
                    for(int i=2;i<=m;++i) {
                        long ispe = nCr(i-2, n-3);
                        ispe*=modpow(2, n-3, MOD);
                        ispe%=MOD;
                        ispe*=(i-1);
                        ispe%=MOD;
                        ans = (ans+ispe)%MOD;
                    }

            pl(ans);

        }

        pw.flush();
        pw.close();
    }

    static long modpow(long x,long y,long mod)
    {
        res = 1;
        while(y>0)
        {
            if((y&1)==1)
                res = (res*x)%mod;
            y>>=1;
            x = (x*x)%mod;
        }
        return res;
    }

    static long nCr(int n,int r)
    {
        if(n<0 || r>n)
            return 0;
        res = fact[n];
        res = (res*invfact[r])%MOD;
        res = (res*invfact[n-r])%MOD;
        return res;
    }

    static void initIo(boolean isFileIO, String suffix) throws IOException {
        scan = new MyScanner(isFileIO, suffix);
        if(isFileIO) {
            pw = new PrintWriter("/Users/amandeep/Desktop/output"+suffix+".txt");
        }
        else {
            pw = new PrintWriter(System.out, true);
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static String ne() throws IOException
    {
        return scan.next();
    }
    static String nel() throws IOException
    {
        return scan.nextLine();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, boolean[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(boolean o : arr[i])
                p(o);
            pl();
        }
    }
    static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;
        MyScanner(boolean readingFromFile, String suffix) throws IOException
        {
            if(readingFromFile) {
                br = new BufferedReader(new FileReader("/Users/amandeep/Desktop/input"+suffix+".txt"));
            }
            else {
                br = new BufferedReader(new InputStreamReader(System.in));
            }
        }
        String nextLine()throws IOException
        {
            return br.readLine();
        }
        String next() throws IOException
        {
            if(st==null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        int nextInt() throws IOException
        {
            return Integer.parseInt(next());
        }
        long nextLong() throws IOException
        {
            return Long.parseLong(next());
        }
        double nextDouble() throws IOException
        {
            return Double.parseDouble(next());
        }
    }
}

import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws Exception {
		int n=sc.nextInt();
		int m=sc.nextInt();
		fac= new long[m+1];
        fac[0]=fac[1]=1;
        for (int i =2;i<=m;i++){
            fac[i]=(i*fac[i-1])%mod;
        }

		pw.println(1l*((nc(m, n-1)*(n-2))%998244353)*Pow(2, n-3,mod)%998244353);

		pw.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader r) {
			br = new BufferedReader(r);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int x, int y) {
			this.x = x;
			this.y = y;
		}

		public String toString() {
			return x + " " + y;
		}

		public int compareTo(pair other) {
			if (this.x == other.x) {
				return this.y - other.y;
			} else {
				return this.x - other.x;
			}
		}
	}

	static class tuble implements Comparable<tuble> {
		int x;
		int y;
		int z;

		public tuble(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		public String toString() {
			return x + " " + y + " " + z;
		}

		public int compareTo(tuble other) {
			if (this.x == other.x) {
				return this.y - other.y;
			} else {
				return this.x - other.x;
			}
		}
	}

	public static long GCD(long a, long b) {
		if (b == 0)
			return a;
		if (a == 0)
			return b;
		return (a > b) ? GCD(a % b, b) : GCD(a, b % a);
	}

	public static long LCM(long a, long b) {
		return a * b / GCD(a, b);
	}

	static long Pow(long a, int e, int mod)	// O(log e)
    {
        a %= mod;
        long res = 1;
        while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    }

    static long nc(int n,int r){
        if (n<r)return 0;
        long v = fac[n];
        v*=Pow(fac[r],mod-2,mod);
        v%=mod;
        v*=Pow(fac[n-r],mod-2,mod);
        v%=mod;
        return v;
    }

	public static boolean isprime(long a) {
		if (a == 0 || a == 1) {
			return false;
		}
		if (a == 2) {
			return true;
		}
		for (int i = 2; i < Math.sqrt(a) + 1; i++) {
			if (a % i == 0) {
				return false;
			}
		}
		return true;
	}
	static long fac[];
	static int mod=998244353;
	static Scanner sc = new Scanner(System.in);
	static PrintWriter pw = new PrintWriter(System.out);
}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
public class Main{
    public long modInverse(long a, long m)
    {
        long m0 = m;
        long y = 0, x = 1;

        if (m == 1)
            return 0;

        while (a > 1)
        {
            long q = a / m;
            long t = m;
            m = a % m;
            a = t;
            t = y;
            y = x - q * y;
            x = t;
        }
        if (x < 0)
            x += m0;

        return x;
    }
    long  modDivide(long a, long b, long m)
    {
        a = a % m;
        long inv = modInverse(b, m);
        return ((inv * a) % m);
    }
    public static void main(String[] args) throws Exception{
        Reader.init(System.in);
        PrintWriter out=new PrintWriter(System.out);
        long n=Reader.nextInt();
        long m=Reader.nextInt();
        long mod=998244353;
        Main mm=new Main();
        long ans=0;
        long prev=1;
        for(long i=n-2;i<=m-1;i++) {
            if(i==n-2) {
                if(i>=0)
                ans+=prev;
            }
            else {
                long temp=mm.modDivide(i,i-(n-2), mod);
                prev*=temp;
                prev%=mod;
                long tt=(prev)%mod;
                ans+=tt;
                ans%=mod;
            }
//          System.out.println(ans);
        }
        for(int i=1;i<=n-3;i++) {
            ans*=2;
            ans%=mod;
        }
        ans*=(n-2);
        ans%=mod;
        out.println(ans);
        out.close();

    }
}
class pair{
    int v1;
    int v2;
    pair(int v1,int v2){
        this.v1=v1;
        this.v2=v2;
    }
}
class a implements Comparator<pair>{
    public int compare(pair p1,pair p2 ) {
        return p1.v1-p2.v1;
    }
}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
//    / call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    static String nextLine() throws IOException{
        return reader.readLine();
    }
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.Point;

public class Main {
	static final long MOD = 998244353L;
	static final long INF = 1000000000000000007L;
	//static final long MOD = 1000000007L;
	//static final int INF = 1000000007;

	//static long[] factorial;

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.ni();
		int M = sc.ni();
		long ans = 0;
		if (N==2) {
			ans = 0;
		} else if (N==3) {
			ans = ((M-0L)*(M-1L)/2)%MOD;
		} else {
			long[] fac = new long[200001];
			fac[0] = 1L;
			for (int i = 1; i <= 200000; i++)
				fac[i] = (fac[i-1]*i)%MOD;

			long C = ((N-2)*(power(2,N-3,MOD)))%MOD;

			for (int k = N-1; k <= M; k++) {
				long num = fac[k-1];
				long den = (fac[N-2]*fac[k-N+1])%MOD;
				long choose = (num*power(den,MOD-2,MOD))%MOD;

				ans = (ans+C*choose)%MOD;
			}
		}
		pw.println(ans);
		pw.close();
	}

	public static long dist(long[] p1, long[] p2) {
		return (Math.abs(p2[0]-p1[0])+Math.abs(p2[1]-p1[1]));
	}

	//Find the GCD of two numbers
	public static long gcd(long a, long b) {
		if (a < b) return gcd(b,a);
		if (b == 0)
			return a;
		else
			return gcd(b,a%b);
	}

	//Fast exponentiation (x^y mod m)
	public static long power(long x, long y, long m) {
		if (y < 0) return 0L;
		long ans = 1;
		x %= m;
		while (y > 0) {
			if(y % 2 == 1)
				ans = (ans * x) % m;
			y /= 2;
			x = (x * x) % m;
		}
		return ans;
	}

	public static int[][] shuffle(int[][] array) {
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		return array;
	}

    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)

		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] a, int[] b) {
				  //return a[0]-b[0]; //ascending order
				  if (a[1] != b[1]) {
					  return (a[1]-b[1]);
				  } else {
					  return (a[0]-b[0]);
				  }
	          }
		});
		return array;
	}

    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] a, long[] b) {
				  if (a[0] < b[0])
					  return -1;
				  else if (a[0] > b[0])
					  return 1;
				  else
					  return 0;
	          }
		});
		return array;
	}

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int ni() {
            return Integer.parseInt(next());
        }

        long nl() {
            return Long.parseLong(next());
        }

        double nd() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
	public static Scanner cin = new Scanner(System.in);
	public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int a[];
	PrintWriter pw = new PrintWriter(System.out);
	StringTokenizer st = null;
	List<List<Long>> list;
	long MOD = 998244353L;
	long acPow2(long e) {
		if (e == 0) {
			return 1;
		}
		long x = acPow2(e/2);
		x = (x * x) % MOD;
		if (e % 2 == 1) {
			x *= 2;
		}
		return x % MOD;
	}
	public void solve() throws Exception {
		list = new ArrayList<>();
		st = new StringTokenizer(br.readLine());
		long n = Long.parseLong(st.nextToken());
		long m = Long.parseLong(st.nextToken());
		long ans = 1;
		for (int i = 0; i < n - 1; i++) {
			ans = (ans * (m-i)) % MOD;
			long v = getRs(i+1, 1, MOD);
			ans = (ans * v) % MOD;
		}
		ans = (ans * (n - 2)) % MOD;
		ans = (ans * acPow2(n-3)) % MOD;
//		ans = (ans * vn) % MOD;
		pw.println(ans);
		pw.flush();
	}
	class GCDOBJ {
		long x, y;
	}
	long extended_gcd(long a, long b, GCDOBJ obj) {
		long ret, tmp;
		if (b == 0) {
			obj.x = 1;
			obj.y = 0;
			return a;
		}
		ret = extended_gcd(b, a % b, obj);
		tmp = obj.x;
		obj.x = obj.y;
		obj.y = tmp - a / b * obj.y;
		return ret;
	}

	long getRs(long a, long b, long n) {
		GCDOBJ obj = new GCDOBJ();
		long d = extended_gcd(a, n, obj);
		long x0 = obj.x * (b / d) % n;
		if (x0 < 0) {
			x0 += n;
		}
		return x0;
	}
	public static void main(String [] args) {
		Main t = new Main();
		try {
			t.solve();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		t.pw.close();
	}

}

import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

/**
 * Created by Katushka on 08.02.2020.
 */
public class CRM626D {

    static final long MOD = 998244353;

    static long binpow(long a, int n) {
        long res = 1;
        while (n > 0) {
            if ((n & 1) > 0)
                res = res * a % MOD;
            a = a * a % MOD;
            n >>= 1;
        }
        return res % MOD;
    }

    static long gcd (long a, long b, long[] x) {
        if (a == 0) {
            x[0] = 0; x[1] = 1;
            return b;
        }
        long[] x1 = {0, 0};

        long d = gcd (b%a, a, x1);
        x[0] = x1[1] - (b / a) * x1[0];
        x[1] = x1[0];
        return d;
    }

    static long qq(long a) {
        long[] x = {0, 0};
        long g = gcd (a, MOD, x);
        if (g != 1)
            throw new IllegalArgumentException();
        else {
            x[0] = (x[0] % MOD + MOD) % MOD;
            return x[0];
        }
    }

    static long c(int n, int k) {
        long res = 1;
        for (int i = 1; i <= k; ++i)
            res = ((res * (n - k + i) % MOD) * qq(i)) % MOD;
        return res;

    }

    public static void main(String[] args) throws FileNotFoundException {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int n = in.nextInt();
        int m = in.nextInt();

        long res = c(m, n - 1);
        res = res * (n - 2) % MOD;
        res = res * binpow(2, n - 3) % MOD;

        out.println(res);
        out.close();
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextString() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public char nextChar() {
            return next().charAt(0);
        }
    }
}

import java.util.*;
import java.io.*;
public class lp1{
static PrintWriter out = new PrintWriter(System.out);
static int mod = 998244353;
public static void main(String[] args){

int n = ni();
int m = ni();
long f[] = new long[Math.max(m,n)+10];
f[0]=1;
for(int i=1;i<f.length;i++)
   f[i]=(f[i-1]*i)%mod;

    long sum=pow(2,n-3,mod);

   long sums= (f[m]*pow(f[n-1],mod-2,mod))%mod;
              sums = (sums*pow(f[m-n+1],mod-2,mod))%mod;

  long ans = (sum*sums)%mod;
       ans = (ans*(n-2))%mod;
     if(ans<0) ans=ans+mod;
  pn(ans);

out.flush();
}
static int[] ai(int n)  // it will give in array of size n
{
    int a[] = new int[n];
    for(int i=0;i<n;i++)
        a[i] = ni();
    return a;
}
static long[] al(int n)  // it will give in array of size n
{
    long a[] = new long[n];
    for(int i=0;i<n;i++)
        a[i] = nl();
    return a;
}

static void p(Object o)
{
   out.print(o);
}
static void pn(Object o)
{
    out.println(o);
}
static int abs(int x)
{
    return x>0 ? x : -x;
}
static long gcd(long a,long b)
{
       if(b%a==0)
          return a;
          return gcd(b%a,a);
}
static void subtract_1(char s[]) // it will subtract 1 from the given number.  number should be positive
{
      if(s[0]=='0') // number is zero
          return;
     int n = s.length,i=n-1;
     while(s[i]=='0')
       i--;
     s[i] = (char)((int)(s[i]-'0') + 47);

     for(int j=i+1;j<n;j++)
         s[j]='9';
}
static long pow(long a,long b,long md)
{
    long ans=1;
    while(b>0)
    {
         if(b%2==1)
           ans = (ans*a)%md;
           a = (a*a)%md;
           b = b/2;
    }
   return ans;
}
static long min(long a,long b){

     return a<b ? a : b;
}
static long max(long a,long b){
     return a>b ? a : b;
}
static boolean pal(String s)
{
   int n = s.length(),i1=0,i2=n-1;

     while(i1<i2)
     {
        if(s.charAt(i1)!=s.charAt(i2))
             return false;
             i1++; i2--;
     }
       return true;
}
static String rev(String r)
{
    String s = "";
    int i= r.length()-1;

    while(i>=0)
    {
        s=s+r.charAt(i);
        i--;
    }
       return s;
}
static FastReader sc=new FastReader();

      static int ni(){
                 int x = sc.nextInt();
                 return(x);
        }
      static long nl(){
              long x = sc.nextLong();
              return(x);
         }
      static String n(){
                 String str = sc.next();
                     return(str);
       }
     static String ns(){
                 String str = sc.nextLine();
                   return(str);
      }
     static double nd(){
               double d = sc.nextDouble();
                 return(d);
       }
  static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

/*
javac d.java && java d
*/

import java.io.*;
import java.math.*;
import java.util.*;

public class d {
	public static void main(String[] args) { new d(); }
	FS in = new FS();
	PrintWriter out = new PrintWriter(System.out);

	int n, m;
	long mod = 998_244_353;
	long[] two, fac, inv;

	d() {
		n = in.nextInt();
		m = in.nextInt();

		two = new long[m + 1];
		long t = 1L;
		for (int i = 0; i <= m; i++) {
			two[i] = t;
			t = (t << 1) % mod;
		}
		fac = new long[m + 1];
		fac[0] = 1L;
		for (int i = 1; i <= m; i++)
			fac[i] = (i * fac[i - 1]) % mod;
		inv = new long[m + 1];
		for (int i = 0; i <= m; i++)
			inv[i] = pow(fac[i], mod - 2);

		out.println(f());
		out.close();
	}

	long f() {
		long x = mult(n - 2, choose(m, n - 1));
		long y = two[n - 2];
		long z = pow(two[1], mod - 2);

		return mult(x, mult(y, z));
	}
	long choose(int x, int y) {
		long t = fac[x];
		long b1 = inv[y];
		long b2 = inv[x - y];
		return mult(t, mult(b1, b2));
	}

	long pow(long x, long y) {
		long z = 1L;
		while (y > 0) {
			if ((y & 1) == 1)
				z = mult(z, x);
			x = mult(x, x);
			y >>= 1;
		}
		return z;
	}
	long mult(long x, long y) {
		long pd = x * y;
		if (pd >= mod) return pd % mod;
		return pd;
	}
	long add(long x, long y) {
		long sm = x + y;
		if (sm >= mod) return sm - mod;
		return sm;
	}

	int abs(int x) { if (x < 0) return -x; return x; }
	long abs(long x) { if (x < 0) return -x; return x; }
	int max(int x, int y) { if (x < y) return y; return x; }
	int min(int x, int y) { if (x > y) return y; return x; }
	long max(long x, long y) { if (x < y) return y; return x; }
	long min(long x, long y) { if (x > y) return y; return x; }
	int gcd(int x, int y) { while (y > 0) { x = y^(x^(y = x)); y %= x; } return x; }
	long gcd(long x, long y) { while (y > 0) { x = y^(x^(y = x)); y %= x; } return x; }
	long lcm(int x, int y) { return ((long) x) * (y / gcd(x, y)); }
	long lcm(long x, long y) { return x * (y / gcd(x, y)); }

	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) {}
			} return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
}

import java.io.*;
import java.util.*;
import java.math.*;

 public class S	{
		static class Pair  implements Comparable<Pair> {
   int a;
   int b;
   public Pair(int x,int y){a=x;b=y;}
   public Pair(){}
   public int compareTo(Pair p1){
      return a+b-p1.a-p1.b;
   }
@Override
public int hashCode() {
	final int prime = 31;
	int result = 1;
	result = prime * result + a;
	result = prime * result + b;
	return result;
}
@Override
public boolean equals(Object obj) {
	Pair p = (Pair)obj;
	if (this.a==p.a && this.b==p.b)
		return true;
	else return false;

}

 }
static class TrieNode{
  TrieNode[]child;
  int w;
  boolean term;
  TrieNode(){
    child = new TrieNode[26];
  }
}
  public static int gcd(int a,int b)
  {
    if(a<b)

      return gcd(b,a);
    if(b==0)
      return a;
    return gcd(b,a%b);

  }
  //static long ans = 0;
  static long mod = 998244353;//(long)(1e9+7);

    public static void main(String[] args) throws Exception {
       new Thread(null, null, "Anshum Gupta", 99999999) {
            public void run() {
                try {
                    solve();
                } catch(Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }

static long pow(long x,long y){
    if(y == 0)return 1;
    if(y==1)return x;
    long a = pow(x,y/2);
    a = (a*a)%mod;
    if(y%2==0){
        return a;
    }
    return (a*x)%mod;
}
static long my_inv(long x) {
	return pow(x,mod-2);
}
static long bin(int n,int r) {
	return (((fact[n]*inv_fact[n-r])%mod)*inv_fact[r])%mod;
}
static long mxx;
static int mxN = (int)(1e5+5);
static long[]fact,inv_fact;
 public static void solve() throws Exception {
   // solve the problem here
   MyScanner s = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out), true);
        int t = 1;//s.nextInt();
        mxx = (long)(1e18+5);
        while(t-->0){
        	int n = s.nextInt();
        	int m = s.nextInt();
        	if(n == 2) {
        		out.println("0");
        		break;
        	}
        	fact = new long[m+1];
        	inv_fact=new long[m+1];
        	fact[1] = inv_fact[1] = 1;
        	for(int i=2;i<=m;i++) {
        		fact[i] = (fact[i-1]*i)%mod;
        		inv_fact[i] = my_inv(fact[i]);
        	}
        	long ans = bin(m,n-1);
        	ans = (ans*(n-2))%mod;
        	ans = (ans * pow(2,n-3))%mod;
        	if(ans < 0)ans += mod;
        	out.println(ans);
        }

        out.flush();
}

    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() { return Long.parseLong(next()); }
        double nextDouble() { return Double.parseDouble(next()); }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    //--------------------------------------------------------
}

import java.util.*;
import java.io.*;
public class Main {
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    long mod = 998244353;
    long[] frac, inv;
    public static void main(String[] args){
        Main main = new Main();
//        String ans = main.solve()<0?"No":"Yes";
        System.out.println(main.solve());
    }
    long solve(){
        int n = sc.nextInt(), m = sc.nextInt();
        if(n==2) return 0;
        if(n==3){
            return ((long) m)*((long) m-1)/2%mod;
        }
        // otherwise n >= 4
        long ans = 0;
        ini(m+5);
        for(int k=n-1;k<=m;k++){
            // k is the maximum value in the array
            long cur = comb(k-1,n-2)*(n-2)%mod;
            long co = power(2,n-3);
            cur = cur*co%mod;
            ans = (ans+cur)%mod;
        }
        return ans;
    }
    long comb(int n, int m){
        if(n<m) return 0;
        return frac[n]*inv[m]%mod*inv[n-m]%mod;
    }
    void ini(int maxn){
        frac = new long[maxn+1]; inv = new long[maxn+1];
        frac[0] = 1;
        for(int i=1;i<=maxn;i++) frac[i] = frac[i-1]*i%mod;
        inv[0] = 1;
        inv[maxn] = power(frac[maxn],mod-2);
        for(int i = maxn-1;i>0;i--){
            inv[i] = inv[i+1]*(i+1)%mod;
        }
    }
    long power(long base, long p){
        long ans = 1;
        while(p>0){
            if(p%2==1) ans = ans*base%mod;
            base = base*base%mod;
            p /= 2;
        }
        return ans;
    }
}

import java.util.*;
import java.io.*;

public class Solution{
	long mod = 998244353L;
	public Solution(){
		FastReader sc = new FastReader();
		int tests = 1;

        for(int t=1; t<=tests; t++){
			solve(sc);
        }
	}

	public void solve(FastReader sc){
		int n = sc.nextInt();
		int m = sc.nextInt();

		long res = binomialCoeff(m, n-1);

		long sum = summation(n-2);

		res *= sum;

		res %= mod;

		System.out.println(res);
	}

	public long summation(int n){
		long res = n;

		for(int i=1; i<=(n-1); i++){
			res *= 2L;
			res %= mod;
		}

		return res;
	}

	public long binomialCoeff(int n, int k) {
        long res = 1L;

        if ( k > n - k )
            k = n - k;

        for (int i = 0; i < k; ++i){
			res *= (n - i);
			res %= mod;
			res *= modInverse(i + 1);
			res %= mod;
        }

        return res;
    }

	public long modInverse(int num){
		return power((long)num, mod-2);
	}

	public long power(long a, long b){
		if(b == 0){
			return 1L;
		}
		if(b%2 == 0){
			return power(((a*a)%mod), b/2L);
		}
		else{
			return ((a*power(((a*a)%mod), b/2L))%mod);
		}
	}

	public static void main(String[] args){
		new Solution();
	}
}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

	public FastReader()
	{
		br = new BufferedReader(new
				 InputStreamReader(System.in));
	}

	String next()
	{
		while (st == null || !st.hasMoreElements())
		{
			try
			{
				st = new StringTokenizer(br.readLine());
			}
			catch (IOException  e)
			{
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt()
	{
		return Integer.parseInt(next());
	}

	long nextLong()
	{
		return Long.parseLong(next());
	}

	double nextDouble()
	{
		return Double.parseDouble(next());
	}

	String nextLine()
	{
		String str = "";
		try
		{
			str = br.readLine();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		return str;
	}
}

import java.util.Scanner;

public class C1312D {

    static final long MODULO = 998244353;

    public static void main(String[] args) {
//        System.out.println(inverse(7, MODULO) * 7 % MODULO);
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        if (n > m + 1 || n < 3) {
            System.out.println(0);
            return;
        }
        // c(m,n-1)*(n-2)*2^(n-3)
        long ans = n - 2;
        for (int a = m, b = n - 1; b >= 1; a--, b--) {
            ans = ans * a % MODULO;
            ans = ans * inverse(b, MODULO) % MODULO;
        }
        for (int i = 0; i < n - 3; i++) {
            ans = (ans << 1) % MODULO;
        }
        System.out.println(ans);
    }

    static long inverse(long a, long m) {
        long[] ans = extgcd(a, m);
        return ans[0] == 1 ? (ans[1] + m) % m : -1;
    }

    private static long[] extgcd(long a, long m) {
        if (m == 0) {
            return new long[]{a, 1, 0};
        } else {
            long[] ans = extgcd(m, a % m);
            long tmp = ans[1];
            ans[1] = ans[2];
            ans[2] = tmp;
            ans[2] -= ans[1] * (a / m);
            return ans;
        }
    }

}

import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[])
    {
        FastReader input=new FastReader();
        PrintWriter out=new PrintWriter(System.out);
        int T=1;
        while(T-->0)
        {
            long n,m;
            n=input.nextInt();
            m=input.nextInt();
            long mod=998244353;
            long a=factorial(m,mod);
            long b=factorial(n-1,mod);
            long c=factorial(m-n+1,mod);
            b=(b%mod*c%mod)%mod;
            b=power(b,mod-2,mod);
            long x=(a%mod*b%mod)%mod;
            long y=n-2;
            long z=power(2,n-3,mod);
            long ans=(x%mod*y%mod)%mod;
            ans=(ans%mod*z%mod)%mod;
            out.println(ans);
        }
        out.close();
    }
    public static long factorial(long a,long m)
    {
        long fac=1;
        while(a>0)
        {
            fac=(fac%m*a%m)%m;
            a--;
        }
        return fac;
    }
    public static long power(long a,long b,long m)
    {
        long res=1;
        while(b>0)
        {
            if(b%2!=0)
            {
                res=(res%m*a%m)%m;
            }
            b=b/2;
            a=(a%m*a%m)%m;
        }
        return res;
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

// Problem : D. Count the Arrays
// Contest : Codeforces - Educational Codeforces Round 83 (Rated for Div. 2)
// URL : https://codeforces.com/problemset/problem/1312/D
// Memory Limit : 512 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class a implements Runnable{

    public static void main(String[] args) {
        new Thread(null, new a(), "process", 1<<26).start();
    }
	public void run() {
		FastReader scan = new FastReader();
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		//PrintWriter out = new PrintWriter("file.out");
		Task solver = new Task();
		//int t = scan.nextInt();
		int t = 1;
		for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
		out.close();
	}

	static class Task {
		static final int inf = Integer.MAX_VALUE;

		public void solve(int testNumber, FastReader sc, PrintWriter pw) {
			//CHECK FOR QUICKSORT TLE
			//***********************//
			//CHECK FOR INT OVERFLOW
			//***********************//
			int n = sc.nextInt();
			int m = sc.nextInt();
			long mod =  998244353;
			long fact1 = 1;
			for(int i = 2; i <= m; i++) {
				fact1 *= i;
				fact1 %= mod;
			}
			long fact2 = 1;
			for(int i = 2; i < n; i++) {
				fact2 *= i;
				fact2 %= mod;
			}
			long fact3 = 1;
			for(int i = 2; i <= m - n + 1; i++) {
				fact3 *= i;
				fact3 %= mod;
			}
			fact1 *= binpow(fact2, mod - 2, mod);
			fact1 %= mod;
			fact1 *= binpow(fact3, mod - 2, mod);
			fact1 %= mod;
			fact1 *= (n - 2);
			fact1 %= mod;
			if(n > 2) {
				fact1 *= binpow(2, n - 3, mod);
			}
			pw.println(fact1%mod);

		}
	}
	static long binpow(long a, long b, long m) {
		a %= m;
		long res = 1;
		while (b > 0) {
			if ((b & 1) == 1)
				res = res * a % m;
			a = a * a % m;
			b >>= 1;
		}
		return res;
	}
	static void sort(int[] x){
		shuffle(x);
		Arrays.sort(x);
	}
	static void sort(long[] x){
		shuffle(x);
		Arrays.sort(x);
	}
	static class tup implements Comparable<tup>{
		int a, b;
		tup(int a,int b){
			this.a=a;
			this.b=b;
		}
		@Override
		public int compareTo(tup o){
			return Integer.compare(o.b,b);
		}
	}
	static void shuffle(int[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(i + 1);
			int temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static void shuffle(long[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(i + 1);
			long temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastReader(String s) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(new File(s)));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}

import java.util.Scanner;

public class D_83 {
    static int mod = 998244353;
    public static long C(long n, long r){
        if(r>n/2) r = n-r;
        if(r==0) return 1;
        long num = 1;
        long den = 1;
        for(int j=1;j<=r;j++){
            num = (num * n--)%mod;
            den = (den * j)%mod;
        }
        return (num*pow(den, mod-2))%mod;
    }
    public static long pow(long a, long b){
        long ret = 1;
        while (b>0){
            if(b%2==1) ret = (ret*a)%mod;
            a = (a*a)%mod;
            b >>=1;
        }
        return ret;
    }
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        long m = in.nextLong();
        if(n<=2){
            System.out.println(0);
            return;
        }
        long ans = ((n-2)*C(m, n-1))%mod;
        ans = (ans * pow(2, n-3))%mod;
        System.out.println(ans);
    }
}

import java.util.*;

public class Main {
    private static final Scanner sc = new Scanner(System.in);
    static final int M = 998244353;

    static int mul(int x, int y) {
        long X = (long) x;
        long Y = (long) y;
        return (int) (X*Y % M);
    }
    static int pow(int k) {
        int ans = 1;
        while (k-- > 0) ans = mul(ans, 2);
        return ans;
    }
    static int add(int x, int y) {
        return (x + y) % M;
    }
    static int div(int x, int y) {
        return mul(x, inverse(y));
    }
    static int inverse(int x) {
        if (x == 0) throw new RuntimeException("zero divisor");
        return exp(x, M-2);
    }
    static int exp(int x, int d) {
        // System.out.printf("exp(%d, %d)\n", x, d);
        if (d == 0) return 1;
        int r = d % 2;
        if (r == 1) return mul(x, exp(x, d-1));
        else return exp(mul(x, x), d/2);
    }

    public static void main(String[] args) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        int ans = 0;

        // System.out.println(inverse(2));

        if (n > 2) {
            int current = mul(pow(n-3), n-2);       //    (x-1)(x-2)...(x-n+2)        2.1, 3.2
            ans = add(ans, current);
            for (int x = n; x <= m; x++) {
                // System.out.println(x + " " + current);
                current = mul(current, x-1);
                current = div(current, x-n+1);
                ans = add(ans, current);
                // System.out.println(x + " " + current);
            }
        }
        System.out.println(ans);
    }
}

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public  class realfast implements Runnable
  {
    private static final int INF = (int) 1e9;
    long in= (long)Math.pow(10,9)+7;
    public  void solve() throws IOException
    {
       long mod = 998244353;

       int n = readInt();
       int m = readInt();

       long fac[]= new long[m+1];
       fac[0]=1;
       for(int i =1;i<=m;i++)
        fac[i]= (i*fac[i-1])%mod;

        long val = 0;

        for(int i=1;i<=n-2;i++)
        {

            long ncr1= ncr(n-2,i,fac,mod);
            int j = (n-1-i);
            j--;
            long ncr2= ncr(n-2-i,j,fac,mod);
            ncr2= (ncr2*i)%mod;
            ncr1= (ncr1*ncr2)%mod;
            val=(val+ncr1)%mod;
        }

        val = (val*ncr(m,n-1,fac,mod))%mod;

        out.println(val);

    }
    public long pow(long n , long p, long mod)
    {
              if(p==0)
                return 1;
            long val = pow(n,p/2,mod)%mod;
            val = (val*val)%mod;

            if(p%2==0)
                return val;
            else
                return (val*n)%mod;
    }
    public long ncr(int n , int c , long fac[], long mod)
    {
           long val =fac[n];
           long val1 = pow(fac[c],mod-2,mod)%mod;
           long val2 = pow(fac[n-c],mod-2,mod)%mod;
           val =(val*val1)%mod;
           val= (val*val2)%mod;
           return val;
    }
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public static void main(String[] args) {
        new Thread(null, new realfast(), "", 128 * (1L << 20)).start();
    }

    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    private BufferedReader reader;
    private StringTokenizer tokenizer;
    private PrintWriter out;

    @Override
    public void run() {
        try {
            if (ONLINE_JUDGE || !new File("input.txt").exists()) {
                reader = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                reader = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            }
            solve();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                reader.close();
            } catch (IOException e) {
                // nothing
            }
            out.close();
        }
    }

    private String readString() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    @SuppressWarnings("unused")
    private int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    @SuppressWarnings("unused")
    private long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    @SuppressWarnings("unused")
    private double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }
}
class edge implements Comparable<edge>{
    int u ;
    int v ;
    int val;
    edge(int u1, int v1 , int val1)
    {
       this.u=u1;
       this.v=v1;
       this.val=val1;
    }
    public int compareTo(edge e)
    {
        return this.val-e.val;
    }
}

import java.util.Scanner;

public class ER82_D {
	private static final int N = 200001;
	private static final int MOD = 998244353;

	public static void main(String[] args) {
		int[] fact = new int[N];
		fact[0] = 1;
		for (int i = 1; i < N; i++) {
			fact[i] = mul(fact[i-1], i);
		}

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();

		int ans = 0;

		if (n > 2) {
			ans = mul(C(m, n-1, fact), mul(n - 2, binpow(2, n - 3)));
		}
		System.out.println(ans);
	}

	private static int add(int x, int y) {
		x += y;

		return x % MOD;

	}

	private static int mul(int x, int y) {
		int res = (int) (((long) x * y) % MOD);
		return res;

	}

	private static int binpow(int x, int y) {
		int z = 1;
		while (y > 0) {
			if (y % 2 != 0)
				z = mul(z, x);
			x = mul(x, x);
			y >>= 1;
		}
		return z;
	}

	private static int inv(int x) {
		return binpow(x, MOD - 2);
	}

	private static int devide(int x, int y) {
		return mul(x, inv(y));
	}

	private static int C(int n, int k, int[] fact) {
		return devide(fact[n], mul(fact[k], fact[n-k]));
	}
}

//package com.netease.music.codeforces;

import java.util.Scanner;

public class Main {
    public static long mul(long a, long b, long mod) {
        a %= mod;

        long result = 1;
        while (b > 0) {
            if (b % 2 == 1) {
                result = result * a;
                a %= mod;
            }
            a = a * a;
            a %= mod;
            b >>= 1;
            result %= mod;
        }
        return result;
    }

    public static void main(String[] args) {
        long mod = 998244353;
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        //ans = (n-2) * C()
//        long ans = 1L * (n - 2) *
        long nn = n - 2;
        long mm = n - 2;
        long ans = 1;
        long last = 1;
        long nxt = 0;
        int cnt = 0;
//        for (; nn < m - 1; nn++) {
        for (; cnt < m - n + 1; nn++, cnt++) {
            long niyuan = mul(nn - mm + 1, mod - 2, mod);

//            nxt = 1L * (nn + 1)  * last / (nn - mm + 1);
            nxt = 1L * (nn + 1) * last;
            nxt %= mod;
            nxt  *= niyuan;
            nxt %= mod;

            ans += nxt;
            last = nxt;
            ans %= mod;
        }
        ans *= (n - 2);
        ans %= mod;
        long p = mul(2, n - 3, mod);
        ans *= p;
        ans %= mod;
        System.out.println(ans);
    }
}

import java.io.*;
import java.util.*;
import java.math.*;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class CountTheArrays {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
    static class TaskA {
        long mod = (long)(998244353);
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            while(testNumber-->0){
                int n = in.nextInt();
                int m = in.nextInt();
                long a = (nCrPFermet(m , n-1 , mod) * (n-2))%mod;
                // out.println(a);
                long b = pow(2 , n-3 , 1 , mod);
                out.println((a*b)%mod);
            }
        }
        public int [][] matrixExpo(int c[][] , int n){
            int a[][] = new int[c.length][c[0].length];
            int b[][] = new int[a.length][a[0].length];
            for(int i=0;i<c.length;i++)
                for(int j=0;j<c[0].length;j++)
                    a[i][j] = c[i][j];
            for(int i=0;i<a.length;i++)
                b[i][i] = 1;
            while(n!=1){
                if(n%2 == 1){
                    b = matrixMultiply(a , a);
                    n--;
                }
                a = matrixMultiply(a , a);
                n/=2;
            }
            return matrixMultiply(a , b);
        }
        public int [][] matrixMultiply(int a[][] , int b[][]){
            int r1 = a.length;
            int c1 = a[0].length;
            int c2 = b[0].length;
            int c[][] = new int[r1][c2];
            for(int i=0;i<r1;i++){
                for(int j=0;j<c2;j++){
                    for(int k=0;k<c1;k++)
                        c[i][j] += a[i][k]*b[k][j];
                }
            }
            return c;
        }
        public long nCrPFermet(int n , int r , long p){
            if(r==0)
                return 1l;
            long fact[] = new long[n+1];
            fact[0] = 1;
            for(int i=1;i<=n;i++)
                fact[i] = (i*fact[i-1])%p;
            long modInverseR = pow(fact[r] , p-2 , 1l , p);
            long modInverseNR = pow(fact[n-r] , p-2 , 1l , p);
            long w = (((fact[n]*modInverseR)%p)*modInverseNR)%p;
            return w;
        }
        public long pow(long a , long b , long res , long mod){
            if(b==0)
                return res;
            if(b==1)
                return (res*a)%mod;
            if(b%2==1){
                res *= a;
                res %= mod;
                b--;
            }
            // System.out.println(a + " " + b + " " + res);
            return pow((a*a)%mod , b/2 , res , mod);
        }
        public long pow(long a , long b , long res){
            if(b == 0)
                return res;
            if(b==1)
                return res*a;
            if(b%2==1){
                res *= a;
                b--;
            }
            return pow(a*a , b/2 , res);
        }
        public void swap(int a[] , int p1 , int p2){
            int x = a[p1];
            a[p1] = a[p2];
            a[p2] = x;
        }
        public void sortedArrayToBST(TreeSet<Integer> a , int start, int end) {
            if (start > end) {
                return;
            }
            int mid = (start + end) / 2;
            a.add(mid);
            sortedArrayToBST(a, start, mid - 1);
            sortedArrayToBST(a, mid + 1, end);
        }
        class Combine{
            int value;
            int delete;
            Combine(int val , int delete){
                this.value = val;
                this.delete = delete;
            }
        }
        class Sort2 implements Comparator<Combine>{
            public int compare(Combine a , Combine b){
                if(a.value > b.value)
                    return 1;
                else if(a.value == b.value && a.delete>b.delete)
                    return 1;
                else if(a.value == b.value && a.delete == b.delete)
                    return 0;
                return -1;
            }
        }
        public int lowerLastBound(ArrayList<Integer> a , int x){
            int l = 0;
            int r = a.size()-1;
            if(a.get(l)>=x)
                return -1;
            if(a.get(r)<x)
                return r;
            int mid = -1;
            while(l<=r){
                mid = (l+r)/2;
                if(a.get(mid) == x && a.get(mid-1)<x)
                    return mid-1;
                else if(a.get(mid)>=x)
                    r = mid-1;
                else if(a.get(mid)<x && a.get(mid+1)>=x)
                    return mid;
                else if(a.get(mid)<x && a.get(mid+1)<x)
                    l = mid+1;
            }
            return mid;
        }
        public int upperFirstBound(ArrayList<Integer> a , Integer x){
            int l = 0;
            int r = a.size()-1;
            if(a.get(l)>x)
                return l;
            if(a.get(r)<=x)
                return r+1;
            int mid = -1;
            while(l<=r){
                mid = (l+r)/2;
                if(a.get(mid) == x && a.get(mid+1)>x)
                    return mid+1;
                else if(a.get(mid)<=x)
                    l = mid+1;
                else if(a.get(mid)>x && a.get(mid-1)<=x)
                    return mid;
                else if(a.get(mid)>x && a.get(mid-1)>x)
                    r = mid-1;
            }
            return mid;
        }
        public int lowerLastBound(int a[] , int x){
            int l = 0;
            int r = a.length-1;
            if(a[l]>=x)
                return -1;
            if(a[r]<x)
                return r;
            int mid = -1;
            while(l<=r){
                mid = (l+r)/2;
                if(a[mid] == x && a[mid-1]<x)
                    return mid-1;
                else if(a[mid]>=x)
                    r = mid-1;
                else if(a[mid]<x && a[mid+1]>=x)
                    return mid;
                else if(a[mid]<x && a[mid+1]<x)
                    l = mid+1;
            }
            return mid;
        }
        public int upperFirstBound(long a[] , long x){
            int l = 0;
            int r = a.length-1;
            if(a[l]>x)
                return l;
            if(a[r]<=x)
                return r+1;
            int mid = -1;
            while(l<=r){
                mid = (l+r)/2;
                if(a[mid] == x && a[mid+1]>x)
                    return mid+1;
                else if(a[mid]<=x)
                    l = mid+1;
                else if(a[mid]>x && a[mid-1]<=x)
                    return mid;
                else if(a[mid]>x && a[mid-1]>x)
                    r = mid-1;
            }
            return mid;
        }
        public long log(float number , int base){
            return (long) Math.floor((Math.log(number) / Math.log(base)));
        }
        public long gcd(long a , long b){
            if(a<b){
                long c = b;
                b = a;
                a = c;
            }
            if(a%b==0)
                return b;
            return gcd(b , a%b);
        }
        public void print2d(long a[][] , PrintWriter out){
            for(int i=0;i<a.length;i++){
                for(int j=0;j<a[i].length;j++)
                    out.print(a[i][j] + " ");
                out.println();
            }
            out.println();
        }
        public void print1d(int a[] , PrintWriter out){
            for(int i=0;i<a.length;i++)
                out.print(a[i] + " ");
            out.println();
            out.println();
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

import java.io.*;
import java.util.*;

/*
Прокрастинирую
*/

public class Main {

    static FastReader in;
    static PrintWriter out;
    static Random rand = new Random();
    static final int INF = (int) (1e9 + 10);
    static final int MOD = (int) (998244353);
    static final int N = (int) (4e5 + 5);
    static final int LOGN = 60;
    static long[] f;

    static long pow(long a, long b) {
        long res = 1;
        while (b > 0) {
            if ((b & 1) != 0) {
                res = (res * a) % MOD;
            }
            a = (a * a) % MOD;
            b >>= 1;
        }
        return res;
    }

    static long inv(long a) {
        return pow(a, MOD - 2);
    }

    static long C(int n, int k) {
        return f[n] * inv(f[k]) % MOD * inv(f[n - k]) % MOD;
    }

    static void solve() {
        int n = in.nextInt();
        int m = in.nextInt();

        f = new long[m + 1];
        f[0] = 1;
        for (int i = 1; i <= m; i++) {
            f[i] = (f[i - 1] * i) % MOD;
        }

        long c = C(m, n - 1) * (n - 2) % MOD;

//        out.println(c);

        long ans = 0;
        for (int i = 2; i <= n - 1; i++) {
            ans += c * C(n - 3, i - 2) % MOD;
            ans %= MOD;
//            out.println(ans);
        }

        out.println(ans);
    }

    public static void main(String[] args) throws FileNotFoundException {
        in = new FastReader(System.in);
//        in = new FastReader(new FileInputStream("input.txt"));
        out = new PrintWriter(System.out);
//        out = new PrintWriter(new FileOutputStream("output.txt"));

        int q = 1;
//        q = in.nextInt();

        while (q-- > 0) {
            solve();
        }

        out.close();
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        Integer nextInt() {
            return Integer.parseInt(next());
        }

        Long nextLong() {
            return Long.parseLong(next());
        }

        Double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(nextLine());
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }
    }
}

//package BaseCodeForCoding;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class CounttheArrays {
	static long MOD = 998244353;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		System.out.println(((((ncr(m, n - 1)) * (n - 2)) % MOD) * pow(2, n - 3)) % MOD);
	}

	public static long ncr(int n, int r) {
		long ans = 1;
		for (int i = 1; i <= r; i++)
			ans = ((ans * (n - r + i)) % MOD * pow(i, MOD - 2)) % MOD;
		return ans;
	}

	public static long pow(long n, long k) {
		long x = 1;
		long y = n;
		while (k != 0) {
			if (k % 2 == 1) {
				x = x * y;
				x %= MOD;
			}
			y = y * y;
			y %= MOD;
			k = k / 2;
		}
		return x;
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        long MOD = 998244353;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int N = in.nextInt(), M = in.nextInt();
            if (N == 2) {
                out.printLine(0);
                return;
            }

            long[] factorials = new long[M + 1];
            long twoPow[] = new long[M + 1];
            factorials[0] = 1;
            for (int i = 1; i <= M; i++) {
                factorials[i] = (factorials[i - 1] * i) % MOD;
            }
            twoPow[0] = 1;
            for (int i = 1; i <= M; i++) {
                twoPow[i] = (twoPow[i - 1] * 2) % MOD;
            }
            long ans = 0;
            for (int i = N - 1; i <= M; i++) {
                long p = factorials[i - 1];
                p = (p * extendedGcd(factorials[N - 2], MOD)[1]) % MOD;
                p = (p * extendedGcd(factorials[i - 1 - N + 2], MOD)[1]) % MOD;
                p = (p * (N - 2)) % MOD;
//            p = (p * (N - 2)) % MOD;
                p = (p * twoPow[N - 3]) % MOD;
                ans = (ans + p) % MOD;
            }
            out.printLine(ans);
        }

        public Long[] extendedGcd(long p, long q) {
            if (q == 0) {
                return new Long[]{p, 1L, 0L};
            }

            Long array[] = extendedGcd(q, p % q);
            long d = array[0] % MOD;
            long a = array[2] % MOD;
            long b = (array[1] % MOD) - (p / q) * a;
            while (b < 0) {
                b += MOD;
            }
            return new Long[]{d, a, b};
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tokenizer = null;

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(in.readLine());
                }
                return tokenizer.nextToken();
            } catch (IOException e) {
                return null;
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}

import java.util.Scanner;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.HashMap;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class D{
	public static final long REMAIN= 998_244_353L;
	public static long findrev(long a, long step){
		long res = 1;
		while(step > 0){
			//System.out.println(a + " " + step + "\n");
			if((step & 1) > 0) res = (res*a)%REMAIN;
			step >>= 1;
			a = (a*a)%REMAIN;
		}
		return res;
	}
	public static void main(String[] args){
			Scanner in = new Scanner(System.in);
			int n = in.nextInt();
			int m = in.nextInt();
			long[] facs = new long[m+1];
			facs[0] = 1;
			long[] facsrev = new long[m+1];
			facsrev[0] = 1;
			for(int i = 1;i<=m;++i){
				facs[i] = (facs[i-1]*i)%REMAIN;
				facsrev[i] = findrev(facs[i],REMAIN - 2);
			}
			//System.out.println(Arrays.toString(facs));
			//System.out.println(Arrays.toString(facsrev));
			// for(int i = 1;i<=m;++i){
				// System.out.println(facs[i] * facsrev[i] %REMAIN + " ");
			// }
			// System.out.println();
			long res = 0;
			for(int i = 2;i<=n-1;++i){
				res = res + (facs[m]*facsrev[n-1])%REMAIN*(i-1)%REMAIN*facsrev[m-n+1]%REMAIN*
						facsrev[i-1]%REMAIN * facs[n-2]%REMAIN * facsrev[n-i-1]%REMAIN;
				res = res % REMAIN;
			}
			System.out.println(res);

	}
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static long sx = 0, sy = 0, m = (long) (1e9 + 7);

	static ArrayList<Integer>[] a;
	static int[] dp;
	static long[] fa;
	static boolean b = true;
	static HashMap<Long, Integer> hm = new HashMap<>();
	// static ArrayList<Integer> p = new ArrayList<>();
	public static PrintWriter out;
	static ArrayList<pair> ans = new ArrayList<>();
	static long[] fact = new long[(int) 1e6];
	static ArrayList<Integer>[] p;
	static StringBuilder sb = new StringBuilder();
	static boolean cycle = false;
	static long mod = 998244353;

	public static void main(String[] args) throws IOException {

		Reader scn = new Reader();

		preprocess();
		long n = scn.nextLong(), m = scn.nextLong();

		long ans = ncr(m, n - 1);
		ans = (ans * pow(2, n - 3)) % mod;
		ans = (ans * (n - 2)) % mod;

		System.out.println(ans);

	}

	public static void preprocess() {
        fact[0] = 1;

		for (int i = 1; i < 1e6; i++)
			fact[i] = (fact[i - 1] * i) % mod;
	}

	public static long ncr(long n, long r) {

		if(n<r)return 0;

		long ans = ((((fact[(int) n] * pow(fact[(int) r], mod - 2)) % mod) * pow(fact[(int) (n - r)], mod - 2)) % mod);
		return ans;
	}

	// _________________________TEMPLATE_____________________________________________________________

	// private static int gcd(int a, int b) {
	// if (a == 0)
	// return b;
	//
	// return gcd(b % a, a);
	// }

	// static class comp implements Comparator<Integer> {
	//
	// @Override
	// public int compare(Integer o1, Integer o2) {
	//
	// return (int) (o2 - o1);
	// }
	//
	// }

	public static long pow(long a, long b) {

		if(b<0)return 0;
		if (b == 0 || b == 1)
			return (long) Math.pow(a, b);

		if (b % 2 == 0) {

			long ret = pow(a, b / 2);
			ret = (ret % mod * ret % mod) % mod;
			return ret;
		}

		else {
			return ((pow(a, b - 1) % mod) * a % mod) % mod;
		}
	}

	private static class pair implements Comparable<pair> {

		int a, b;

		pair(int c, int d) {

			a = c;
			b = d;
		}

		@Override
		public int compareTo(pair o) {

			return 1;
		}

	}

	public static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[1000000 + 1]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}

		public int[][] nextInt2DArray(int m, int n) throws IOException {
			int[][] arr = new int[m][n];
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < n; j++)
					arr[i][j] = nextInt();
			}
			return arr;
		}
		// kickstart - Solution
		// atcoder - Main
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author maheshwari29
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        CAddingPowers solver = new CAddingPowers();
        solver.solve(1, in, out);
        out.close();
    }

    static class CAddingPowers {
        static long mod = 998244353;

        static long exponent(long a, long n) {
            long ans = 1;
            while (n != 0) {
                if (n % 2 == 1) ans = (ans * a) % mod;
                a = (a * a) % mod;
                n = n >> 1;
            }
            return ans;
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int i, j;
            int n = in.ni();
            int m = in.ni();
            long temp[] = new long[200001];
            if (n == 2) {
                out.println(0);
                return;
            }
            temp[1] = 1;
            temp[0] = 1;
            for (i = 1; i <= 200000; i++)
                temp[i] = (temp[i - 1] * i) % mod;
            long power = exponent(2, n - 3);
            long num = temp[m];
            long den = (temp[n - 1] * temp[m - n + 1]) % mod;
            long den2 = exponent(den, mod - 2);
            long ans = (den2 * num) % mod;
            long ans1 = (ans * (n - 2)) % mod;
            long ans3 = (power * ans1) % mod;
            out.println(ans3);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}

import java.util.Scanner;

public class ER82_D {
	private static final int N = 200001;
	private static final int MOD = 998244353;

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int[] fact = new int[m+1];
		fact[0] = 1;
		for (int i = 1; i < m+1; i++) {
			fact[i] = mul(fact[i-1], i);
		}
		int ans = 0;

		if (n > 2) {
			ans = mul(C(m, n-1, fact), mul(n - 2, binpow(2, n - 3)));
		}
		System.out.println(ans);
	}

	private static int add(int x, int y) {
		x += y;

		return x % MOD;

	}

	private static int mul(int x, int y) {
		int res = (int) (((long) x * y) % MOD);
		return res;

	}

	private static int binpow(int x, int y) {
		int z = 1;
		while (y > 0) {
			if (y % 2 != 0)
				z = mul(z, x);
			x = mul(x, x);
			y >>= 1;
		}
		return z;
	}

	private static int inv(int x) {
		return binpow(x, MOD - 2);
	}

	private static int devide(int x, int y) {
		return mul(x, inv(y));
	}

	private static int C(int n, int k, int[] fact) {
		return devide(fact[n], mul(fact[k], fact[n-k]));
	}
}

import java.util.*;
import java.io.*;

public class dsu {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		int mod = 998244353;

		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());

		if (n == 2)
			System.out.println(0);
		else
			System.out.println((((nCrModPFermat(m,n-1, mod) % mod * (n - 2)) % mod) * power(2, n - 3,mod)) % mod);
		pw.flush();
	}

	static int gcd(int a, int b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		pair(int r, int t) {
			x = r;
			y = t;
		}

		public String toString() {
			return "(" + x + "," + y + ")";
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			return o.x - x;
		}

	}

	static long power(long x, long y, int p) {

		// Initialize result
		long res = 1;

		// Update x if it is more than or
		// equal to p
		x = x % p;

		while (y > 0) {

			// If y is odd, multiply x
			// with result
			if (y % 2 == 1)
				res = (res * x) % p;

			// y must be even now
			y = y >> 1; // y = y/2
			x = (x * x) % p;
		}

		return res;
	}

	// Returns n^(-1) mod p
	static long modInverse(long n, int p) {
		return power(n, p - 2, p);
	}

	// Returns nCr % p using Fermat's
	// little theorem.
	static long nCrModPFermat(int n, int r, int p) {

		// Base case
		if (r == 0)
			return 1;

		// Fill factorial array so that we
		// can find all factorial of r, n
		// and n-r
		long[] fac = new long[n + 1];
		fac[0] = 1;

		for (int i = 1; i <= n; i++)
			fac[i] = (fac[i - 1] * i) % p;

		return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;

public class COVID {

static int mod =998244353 ;
static long[] fac;
public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int n=sc.nextInt();
		int m =sc.nextInt();
		fac=new long[m+1];
		fac[0]=fac[1]=1;
		for(int i=2;i<fac.length;i++)
			fac[i]=(fac[i-1]*i)%mod;
		long ans=(powmod(2, n-3, mod)*(n-2)) %mod;
		ans*=ncr(m, n-1);

		pw.println(ans%mod);
		pw.flush();
	}

public static long ncr(int n , int r ) {
	if(n<r) return 0;
	long ans=fac[n];
	ans=(ans*powmod(fac[n-r], mod-2, mod))%mod;
	ans=(ans*powmod(fac[r], mod-2, mod))%mod;
	return ans;
}
static int log(long n, long r)
{
    return (n > r - 1) ? 1 + log(n / r, r) : 0;
}

public static long powmod(long x ,int p,int mod) {// loop O(log p )
	long ans=1;
	x%=mod;
	while(p>0) {

		if((p&1)==1)
			ans= (ans*x)%mod;
	x=(x*x)%mod;
	p>>=1;
	}
	return ans;
}
static class pair{
	int x,y;
	public pair(int a, int b) {
		this.x=a;y=b;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + x;
		result = prime * result + y;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		pair other = (pair) obj;
		if (x != other.x)
			return false;
		if (y != other.y)
			return false;
		return true;
	}

}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++) {
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
				if (sb.length() == 18) {
					res += Long.parseLong(sb.toString()) / f;
					sb = new StringBuilder("0");
				}
			}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

	public static void shuffle(int[] a) {
		int n = a.length;
		for (int i = 0; i < n; i++) {
			int r = i + (int) (Math.random() * (n - i));
			int tmp = a[i];
			a[i] = a[r];
			a[r] = tmp;
		}
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.awt.Point;

// U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE................
// ASCII = 48 + i ;// 2^28 = 268,435,456  > 2* 10^8 // log 10 base 2 = 3.3219
// odd:: (x^2+1)/2 , (x^2-1)/2 ; x>=3// even:: (x^2/4)+1 ,(x^2/4)-1  x >=4
// FOR ANY ODD NO N : N,N-1,N-2
//ALL ARE PAIRWISE COPRIME
//THEIR COMBINED LCM IS PRODUCT OF ALL THESE NOS

// two consecutive odds are always coprime to each other
// two consecutive even have always gcd  = 2 ;

public class Main
{

    // static int[] arr = new int[100002] ;
    // static int[] dp = new int[100002] ;

     static PrintWriter out;

	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br=new BufferedReader(new InputStreamReader(System.in));
			out=new PrintWriter(System.out);
		}
		String next(){
			while(st==null || !st.hasMoreElements()){
				try{
					st= new StringTokenizer(br.readLine());
				}
				catch (IOException e){
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String nextLine(){
			String str = "";
			try{
				str=br.readLine();
			}
			catch(IOException e){
				e.printStackTrace();
			}
			return str;
		}
	}

////////////////////////////////////////////////////////////////////////////////////
 public static int countDigit(long n)
    {
        return (int)Math.floor(Math.log10(n) + 1);
    }

/////////////////////////////////////////////////////////////////////////////////////////

 public static int sumOfDigits(long n)
 {

  if( n< 0)return -1 ;

  int sum = 0;

  while( n > 0)
  {
      sum = sum + (int)( n %10) ;

      n /= 10 ;
  }

  return sum ;

 }

 //////////////////////////////////////////////////////////////////////////////////////////////////

public static long arraySum(int[] arr , int start , int end)
{
    long ans = 0 ;

    for(int i = start ; i <= end  ; i++)ans += arr[i] ;

    return ans  ;
}

/////////////////////////////////////////////////////////////////////////////////

public static int mod(int x)
{
      if(x <0)return -1*x ;
      else return x ;
}
public static long mod(long x)
{
      if(x <0)return -1*x ;
      else return x ;
}

////////////////////////////////////////////////////////////////////////////////

public static void swapArray(int[] arr , int start , int end)
{
    while(start < end)
    {
        int temp = arr[start] ;
        arr[start] = arr[end];
        arr[end] = temp;
        start++ ;end-- ;
    }
}

//////////////////////////////////////////////////////////////////////////////////

public static int[][] rotate(int[][] input){

int n =input.length;
int m = input[0].length ;
int[][] output = new int [m][n];

for (int i=0; i<n; i++)
	for (int j=0;j<m; j++)
		output [j][n-1-i] = input[i][j];
return output;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////

public static int countBits(long n)
    {
        int count = 0;
        while (n != 0)
        {
            count++;
            n = (n) >> (1L) ;
        }

        return count;

    }
/////////////////////////////////////////// ////////////////////////////////////////////////

public static boolean isPowerOfTwo(long n)
{
    if(n==0)
    return false;

if(((n ) & (n-1)) == 0 ) return true ;
else return false  ;

}

/////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////

public static String reverse(String input)
{
  StringBuilder str  = new StringBuilder("") ;

    for(int i =input.length()-1 ; i >= 0  ; i-- )
    {
        str.append(input.charAt(i));
    }

return str.toString() ;
}
///////////////////////////////////////////////////////////////////////////////////////////

public static boolean sameParity(long a  ,long b )
{
     long x = a% 2L; long y = b%2L ;
     if(x==y)return true  ;
     else return false  ;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
public static boolean isPossibleTriangle(int a  ,int b , int c)
{
      if( a + b > c && c+b > a && a +c > b)return true  ;
      else return false  ;
}

////////////////////////////////////////////////////////////////////////////////////////////
static long xnor(long num1, long num2) {
		if (num1 < num2) {
			long temp = num1;
			num1 = num2;
			num2 = temp;
		}
		num1 = togglebit(num1);
		return num1 ^ num2;
	}

	static long togglebit(long n) {
		if (n == 0)
			return 1;
		long i = n;
		n |= n >> 1;
		n |= n >> 2;
		n |= n >> 4;
		n |= n >> 8;
		n |= n >> 16;
		return i ^ n;
	}

///////////////////////////////////////////////////////////////////////////////////////////////

public static int xorOfFirstN(int n)
{

 if( n % 4 ==0)return n ;

 else if( n % 4 == 1)return 1 ;

 else if( n % 4 == 2)return n+1 ;

 else return 0 ;

}
//////////////////////////////////////////////////////////////////////////////////////////////

public static int gcd(int a, int b )
{

if(b==0)return a ;

else return gcd(b,a%b) ;

}

public static long gcd(long a, long b )
{

if(b==0)return a ;

else return gcd(b,a%b) ;

}

////////////////////////////////////////////////////////////////////////////////////

public static int lcm(int a, int b ,int c , int d )
{

int temp = lcm(a,b , c) ;

 int ans = lcm(temp ,d ) ;

return ans  ;

}

///////////////////////////////////////////////////////////////////////////////////////////

public static int lcm(int a, int b ,int c )
{

int temp = lcm(a,b) ;

int ans =  lcm(temp ,c) ;

return ans  ;

}

////////////////////////////////////////////////////////////////////////////////////////

public static int lcm(int a , int b )
{

int gc = gcd(a,b);

return (a*b)/gc ;
}

public static long lcm(long a , long b )
{

long gc = gcd(a,b);

return (a*b)/gc ;
}

///////////////////////////////////////////////////////////////////////////////////////////
static boolean isPrime(long n)
{
      if(n==1)
      {
            return false  ;
      }

      boolean ans =  true  ;

      for(long i = 2L; i*i <= n ;i++)
      {
            if(n% i ==0)
            {
                  ans = false  ;break ;
            }
      }

      return ans  ;
}

static boolean isPrime(int n)
{
      if(n==1)
      {
            return false  ;
      }

      boolean ans =  true  ;

      for(int i = 2; i*i <= n ;i++)
      {
            if(n% i ==0)
            {
                  ans = false  ;break ;
            }
      }

      return ans  ;
}

///////////////////////////////////////////////////////////////////////////

static int sieve =  1000000 ;

static boolean[] prime =  new boolean[sieve + 1] ;

public static void sieveOfEratosthenes()
    {
        // FALSE == prime

        // TRUE ==  COMPOSITE

        // FALSE== 1

        // time complexity = 0(NlogLogN)== o(N)

        // gives prime nos bw 1 to N

        for(int i = 4; i<= sieve ; i++)
        {
            prime[i] = true  ;
            i++ ;
        }

        for(int p = 3; p*p <= sieve; p++)
        {

            if(prime[p] == false)
            {

                for(int i = p*p; i <= sieve; i += p)
                    prime[i] = true;
            }

            p++ ;
        }

    }

///////////////////////////////////////////////////////////////////////////////////

public static void sortD(int[] arr , int s  , int e)
{
      sort(arr ,s , e) ;

      int i =s ; int j = e  ;

      while( i < j)
      {
            int temp = arr[i] ;
            arr[i] =arr[j] ;
            arr[j] = temp ;
            i++ ; j-- ;
      }

      return ;
}

/////////////////////////////////////////////////////////////////////////////////////////

public static long countSubarraysSumToK(long[] arr ,long sum )
    {
      HashMap<Long,Long> map = new HashMap<>() ;

      int n = arr.length ;

      long prefixsum = 0 ;

      long count = 0L ;
      for(int i  = 0; i < n ; i++)
      {
          prefixsum  = prefixsum +  arr[i] ;

          if(sum == prefixsum)count = count+1 ;

          if(map.containsKey(prefixsum -sum))
          {
              count = count + map.get(prefixsum -sum) ;
          }

          if(map.containsKey(prefixsum ))
          {
              map.put(prefixsum , map.get(prefixsum) +1 );
          }

          else{
              map.put(prefixsum , 1L );
          }

      }

      return count  ;

    }

///////////////////////////////////////////////////////////////////////////////////////////////

// KMP ALGORITHM : TIME COMPL:O(N+M)
// FINDS THE OCCURENCES OF PATTERN AS A  SUBSTRING IN STRING
//RETURN THE ARRAYLIST OF INDEXES
// IF SIZE OF LIST IS ZERO MEANS PATTERN IS NOT PRESENT IN STRING

public static ArrayList<Integer> kmpAlgorithm(String str , String pat)
     {
        ArrayList<Integer> list =new ArrayList<>();

        int n = str.length() ;
        int m = pat.length() ;

        String q = pat + "#" + str ;

        int[] lps  =new int[n+m+1] ;

         longestPefixSuffix(lps, q,(n+m+1)) ;

         for(int i =m+1 ; i < (n+m+1) ; i++ )
         {
             if(lps[i] == m)
             {
                 list.add(i-2*m) ;
             }
         }

        return list ;

    }

public static void longestPefixSuffix(int[] lps ,String str , int n)
    {
        lps[0] =  0 ;

        for(int i = 1  ; i<= n-1; i++)
        {
          int l = lps[i-1] ;

          while( l > 0 && str.charAt(i) != str.charAt(l))
          {
              l = lps[l-1] ;
          }

          if(str.charAt(i) == str.charAt(l))
          {
              l++ ;
          }

          lps[i] = l ;
        }

    }

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

 // CALCULATE TOTIENT Fn FOR ALL VALUES FROM 1 TO n
    // TOTIENT(N) = count of nos less than n and grater than 1 whose gcd with n is 1
    // or n and the no  will be coprime in nature
    //time : O(n*(log(logn)))

    public static void eulerTotientFunction(int[] arr ,int n )
    {

      for(int i = 1; i <= n  ;i++)arr[i] =i  ;

      for(int i= 2 ; i<= n ;i++)
      {
          if(arr[i] == i)
          {
              arr[i] =i-1 ;

              for(int j =2*i ; j<= n  ; j+= i )
              {
                  arr[j] = (arr[j]*(i-1))/i ;
              }

          }
      }

      return  ;

    }

/////////////////////////////////////////////////////////////////////////////////////////////
public static long nCr(int n,int k)
{
    long ans=1L;
    k=k>n-k?n-k:k;
    int j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}

///////////////////////////////////////////////////////////////////////////////////////////

public static ArrayList<Integer> allFactors(int n)
{
      ArrayList<Integer> list = new ArrayList<>() ;

    for(int i = 1; i*i <= n ;i++)
    {
          if( n % i == 0)
          {
              if(i*i == n)
              {
                    list.add(i) ;
              }
              else{
                    list.add(i) ;
                    list.add(n/i) ;

              }
          }
    }

     return list ;

}

public static ArrayList<Long> allFactors(long n)
{
      ArrayList<Long> list = new ArrayList<>() ;

    for(long i = 1L; i*i <= n ;i++)
    {
          if( n % i == 0)
          {
              if(i*i == n)
              {
                    list.add(i) ;
              }
              else{
                    list.add(i) ;
                    list.add(n/i) ;

              }
          }
    }

     return list ;

}
////////////////////////////////////////////////////////////////////////////////////////////////////

  static final int MAXN = 10000001;

    static int spf[] = new int[MAXN];

    static void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)

            spf[i] = i;

        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAXN; i++)
        {

            if (spf[i] == i)
            {

                for (int j=i*i; j<MAXN; j+=i)

                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }

// The above code works well for n upto the order of 10^7.
// Beyond this we will face memory issues.

// Time Complexity: The precomputation for smallest prime factor is done in O(n log log n)
// using sieve.
// Where as in the calculation step we are dividing the number every time by
// the smallest prime number till it becomes 1.
// So, let’s consider a worst case in which every time the SPF is 2 .
// Therefore will have log n division steps.

// Hence, We can say that our Time Complexity will be O(log n) in worst case.

    static Vector<Integer> getFactorization(int x)
    {
        Vector<Integer> ret = new Vector<>();
        while (x != 1)
        {
            ret.add(spf[x]);
            x = x / spf[x];
        }
        return ret;
    }

 //////////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////////

public static void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int[n1];
        int R[] = new int[n2];

       //Copy data to temp arrays
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
  public static void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

public static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

public static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long[n1];
        long R[] = new long[n2];

        //Copy data to temp arrays
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

 /////////////////////////////////////////////////////////////////////////////////////////

	public static long knapsack(int[] weight,long value[],int maxWeight){

        int n=  value.length ;

	//dp[i] stores the profit with KnapSack capacity "i"
  long []dp = new long[maxWeight+1];

    //initially profit with 0 to W KnapSack capacity is 0
    Arrays.fill(dp, 0);

    // iterate through all items
    for(int i=0; i < n; i++)

        //traverse dp array from right to left
        for(int j = maxWeight; j >= weight[i]; j--)
            dp[j] = Math.max(dp[j] , value[i] + dp[j - weight[i]]);

    /*above line finds out maximum of dp[j](excluding ith element value)
    and val[i] + dp[j-wt[i]] (including ith element value and the
    profit with "KnapSack capacity - ith element weight") */
    return dp[maxWeight];
	}

///////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////

// to return max sum of any subarray in given array
public static long kadanesAlgorithm(long[] arr)
{

    if(arr.length == 0)return  0 ;

      long[] dp = new long[arr.length] ;

      dp[0] = arr[0] ;
      long max =  dp[0] ;

      for(int i = 1; i <  arr.length ; i++)
      {
            if(dp[i-1] > 0)
            {
                  dp[i] = dp[i-1] + arr[i] ;
            }
            else{
                  dp[i] = arr[i] ;
            }

            if(dp[i] >  max)max = dp[i] ;

      }

      return max  ;

}
/////////////////////////////////////////////////////////////////////////////////////////////
public static long kadanesAlgorithm(int[] arr)
{
     if(arr.length == 0)return  0 ;

      long[] dp = new long[arr.length] ;

      dp[0] = arr[0] ;
      long max =  dp[0] ;

      for(int i = 1; i <  arr.length ; i++)
      {
            if(dp[i-1] > 0)
            {
                  dp[i] = dp[i-1] + arr[i] ;
            }
            else{
                  dp[i] = arr[i] ;
            }

            if(dp[i] >  max)max = dp[i] ;

      }

      return max  ;

}

///////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////

public static long binarySerachGreater(int[] arr , int start , int end , int val)
{

      // fing total no of elements strictly grater than val in sorted array arr

      if(start >  end)return  0 ; //Base case

      int mid = (start + end)/2  ;

      if(arr[mid] <=val)
      {
          return binarySerachGreater(arr,mid+1, end ,val) ;

      }
      else{

         return binarySerachGreater(arr,start , mid -1,val) + end-mid+1 ;

      }

}

//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////

//TO GENERATE ALL(DUPLICATE ALSO EXIST) PERMUTATIONS OF A STRING

// JUST CALL generatePermutation( str,  start,  end) start :inclusive ,end : exclusive

//Function for swapping the characters at position I with character at position j
    public static String swapString(String a, int i, int j) {
        char[] b =a.toCharArray();
        char ch;
        ch = b[i];
        b[i] = b[j];
        b[j] = ch;
        return String.valueOf(b);
    }

//Function for generating different permutations of the string
    public static void generatePermutation(String str, int start, int end)
    {
        //Prints the permutations
        if (start == end-1)
            System.out.println(str);
        else
        {
            for (int i = start; i < end; i++)
            {
                //Swapping the string by fixing a character
                str = swapString(str,start,i);
                //Recursively calling function generatePermutation() for rest of the characters
                generatePermutation(str,start+1,end);
                //Backtracking and swapping the characters again.
                str = swapString(str,start,i);
            }
        }
    }

////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////

public static long factMod(long n, long mod) {
    if (n <= 1) return 1;
    long ans = 1;
    for (int i = 1; i <= n; i++) {
      ans = (ans * i) % mod;
    }
    return ans;
  }

/////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////

public static long power(int a  ,int b)
    {
        //time comp : o(logn)

        long x = (long)(a) ;
         long n = (long)(b) ;

        if(n==0)return 1 ;
        if(n==1)return x;

        long ans =1L  ;

      while(n>0)
      {
          if(n % 2 ==1)
          {
              ans = ans *x ;
          }

          n = n/2L ;

          x =  x*x ;

      }

      return ans ;
    }

////////////////////////////////////////////////////////////////////////////////////////////////////
public static long powerMod(long x, long n, long mod) {
    //time comp : o(logn)

    if(n==0)return 1L ;
        if(n==1)return x;

    long ans = 1;
    while (n > 0) {
      if (n % 2 == 1) ans = (ans * x) % mod;
      x = (x * x) % mod;
      n /= 2;
    }
    return ans;
  }

//////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////

/*
lowerBound - finds largest element equal or less than value paased
upperBound - finds smallest element equal or more than value passed

if not present return -1;

*/

public static long lowerBound(long[] arr,long k)
	{
		long ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]<=k)
			{
				ans=arr[mid];
				start=mid+1;
			}
			else
			{
				end=mid-1;
			}

		}

		return ans;

	}

	public static int lowerBound(int[] arr,int k)
	{
		int ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]<=k)
			{
				ans=arr[mid];
				start=mid+1;
			}
			else
			{
				end=mid-1;
			}

		}

		return ans;

	}

	public static long upperBound(long[] arr,long k)
	{
		long ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]>=k)
			{
				ans=arr[mid];
				end=mid-1;
			}
			else
			{
				start=mid+1;
			}

		}

		return ans;
	}

	public static int upperBound(int[] arr,int k)
	{
		int ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]>=k)
			{
				ans=arr[mid];
				end=mid-1;
			}
			else
			{
				start=mid+1;
			}

		}

		return ans;
	}

//////////////////////////////////////////////////////////////////////////////////////////

public static void printArray(int[] arr , int si ,int ei)
{
    for(int i = si  ; i  <= ei ; i++)
    {
        out.print(arr[i] +" ") ;
    }

}

public static void printArrayln(int[] arr , int si ,int ei)
{
    for(int i = si  ; i  <= ei ; i++)
    {
        out.print(arr[i] +" ") ;
    }
    out.println() ;
}

public static void printLArray(long[] arr , int si , int ei)
{
    for(int i = si ; i  <= ei ; i++)
    {
        out.print(arr[i] +" ") ;
    }

}

public static void printLArrayln(long[] arr , int si , int ei)
{
    for(int i = si ; i  <= ei ; i++)
    {
        out.print(arr[i] +" ") ;
    }
    out.println() ;

}

public static void printtwodArray(int[][] ans)
{
    for(int i = 0; i< ans.length ; i++)
    {
        for(int j  = 0 ; j <  ans[0].length ; j++)out.print(ans[i][j] +" ");
        out.println() ;
    }
    out.println() ;

}

   static long modPow(long a, long x, long p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}

  static long modInverse(long a, long p) {
    //calculates the modular multiplicative of a mod p.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}

static long modBinomial(long n, long k, long p) {
// calculates C(n,k) mod p (assuming p is prime).

    long numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (int i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    long denominator = 1; // k!
    for (int i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}

 static void update(int val , long[] bit ,int n)
 {
     for( ; val <= n ; val += (val &(-val)) )
     {
         bit[val]++ ;
     }

 }

 static long query(int val , long[] bit , int n)
 {
     long ans = 0L;
     for( ; val >=1 ; val-=(val&(-val))  )ans += bit[val];

     return ans ;
 }

static int countSetBits(long n)
    {
        int count = 0;
        while (n > 0) {
            n = (n) & (n - 1L);
            count++;
        }
        return count;
    }

/////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////

// static ArrayList<Integer>[] tree ;
// static long[] child;
// static int mod= 1000000007 ;
// static int[][] pre  = new int[3001][3001];
// static int[][] suf = new int[3001][3001] ;

//program to calculate noof nodes in subtree for every vertex including itself

// static void dfs(int sv)
// {
//     child[sv] = 1L;

//     for(Integer x : tree[sv])
//     {
//         if(child[x] == 0)
//         {

//           dfs(x) ;

//           child[sv] += child[x] ;
//         }
//     }
// }

static long factorial(long a)
{
    if(a== 0L || a==1L)return 1L ;

    return a*factorial(a-1L) ;
}

//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////

public static void solve()
{
FastReader scn = new FastReader() ;

//Scanner scn = new Scanner(System.in);
//int[] store = {2 ,3, 5 , 7  ,11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 } ;

// product of first 11 prime nos is greater than 10 ^ 12;

//ArrayList<Integer> arr[] = new ArrayList[n] ;
ArrayList<Integer> list = new ArrayList<>() ;
ArrayList<Long> lista = new ArrayList<>() ;
ArrayList<Long> listb = new ArrayList<>() ;
// ArrayList<Integer> lista = new ArrayList<>() ;
// ArrayList<Integer> listb = new ArrayList<>() ;
//ArrayList<String> lists = new ArrayList<>() ;

HashMap<Integer,Integer> map = new HashMap<>() ;
//HashMap<Long,Long> map = new HashMap<>() ;
HashMap<Integer,Integer> map1  = new HashMap<>() ;
HashMap<Integer,Integer> map2  = new HashMap<>() ;
//HashMap<String,Integer> maps = new HashMap<>() ;
//HashMap<Integer,Boolean> mapb = new HashMap<>() ;
//HashMap<Point,Integer> point = new HashMap<>() ;

 Set<Integer> set = new HashSet<>() ;
 Set<Integer> setx = new HashSet<>() ;
 Set<Integer> sety = new HashSet<>() ;

StringBuilder sb =new StringBuilder("") ;

//Collections.sort(list);

//if(map.containsKey(arr[i]))map.put(arr[i] , map.get(arr[i]) +1 ) ;
//else map.put(arr[i],1) ;

// if(map.containsKey(temp))map.put(temp , map.get(temp) +1 ) ;
// else map.put(temp,1) ;

//int bit  =Integer.bitCount(n);
// gives total no of set bits in n;

// Arrays.sort(arr, new Comparator<Pair>() {
// 			@Override
// 			public int compare(Pair a, Pair b) {
// 				if (a.first != b.first) {
// 					return a.first - b.first; // for increasing order of first
// 				}
// 				return a.second - b.second ; //if first is same then sort on second basis
// 			}
// 		});

int testcase = 1;
 //testcase = scn.nextInt() ;
for(int testcases =1  ; testcases <= testcase ;testcases++)
{

 //if(map.containsKey(arr[i]))map.put(arr[i],map.get(arr[i])+1) ;else map.put(arr[i],1) ;
 //if(map.containsKey(temp))map.put(temp,map.get(temp)+1) ;else map.put(temp,1) ;
// tree = new ArrayList[n] ;
// child  = new long[n] ;
// for(int i = 0; i< n; i++)
// {
//     tree[i] = new ArrayList<Integer>();
// }

long n = scn.nextLong() ;
long m = scn.nextLong() ;

 // m  >= n

 if( n==2)out.println(0) ;

 else{

     long ans = modBinomial(m , n-1 , 998244353L ) ;

     ans=  ans * (n-2) ;

     ans = ans % 998244353L ;

     ans =  ans *(modPow(2,n-3 , 998244353L )) ;

     ans = ans % 998244353L ;

     out.println(ans) ;
 }

set.clear() ;
sb.delete(0 , sb.length()) ;
list.clear() ;lista.clear() ;listb.clear() ;
map.clear() ;
map1.clear() ;
map2.clear() ;
setx.clear() ;sety.clear() ;

} // test case  end loop

out.flush() ;
} // solve fn ends

public static void main (String[] args) throws java.lang.Exception
{

solve() ;

}

}

 class Pair
{
  int first ;

  int second  ;

@Override
	public String toString() {

	String ans = "" ;
	ans  += this.first ;
	ans += " ";
	ans += this.second ;

	return ans  ;
	}

}

import java.io.*;
import java.util.StringTokenizer;

public class Solution {
    private static final long[] fact = new long[200001];
    private static int maxFact = 1;
    private static final int MOD = 998244353;

    public static void main(String[] args) {

        try {
            FastScanner in = new FastScanner(System.in);
            PrintWriter out = new PrintWriter(System.out);

            int n = in.nextInt();
            int m = in.nextInt();
            long sol = 0L;
            if (n != 2) {
                long choose = choose(m, n - 1);
                long val = 1;
                for (int i = 0; i < n - 3; i++) {
                    val = (val << 1) % MOD;
                }
                sol = (val * choose % MOD) * (n - 2) % MOD;
            }
            out.println(sol);
            out.close();

        } catch(Exception exc) {
            throw new RuntimeException(exc);
        }
    }

    static int pow(long b, int e) {
        long ans = 1;
        while (e > 0) {
            if (e % 2 == 1)
                ans = ans * b % MOD;
            e >>= 1;
            b = b * b % MOD;
        }
        return (int) ans;
    }

    static int inv(long x) {
        return pow(x, MOD - 2);
    }

    private static long factorial(int n) {
        fact[0] = 1;
        if (fact[n] != 0)
            return fact[n];

        int j = maxFact;
        while (j <= n) {
            fact[j] = (fact[j - 1] * j) % MOD;
            j++;
            maxFact++;
        }
        return fact[n];

    }

    private static long choose(int n, int k) {
        return (factorial(n) * inv(factorial(k) * factorial(n - k) % MOD)) % MOD;
    }

    //@
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream i) {
            br = new BufferedReader(new InputStreamReader(i));
            st = new StringTokenizer("");
        }

        public String next() throws IOException {
            if(st.hasMoreTokens())
                return st.nextToken();
            else
                st = new StringTokenizer(br.readLine());
            return next();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
        //#
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
        //$
    }
}

import java.io.*;
import java.util.*;
public class Main{
	static long[]fac;
	static long mod=998244353;
	static long modPow(long a, long e){
		long res = 1;
		while(e > 0)
		{
			if((e & 1) == 1)
				res = (res * a) % mod;
			a = (a * a) % mod;
			e >>= 1;
		}
		return res;
	}
	public static long nck(int n,int k) {
		long num=fac[n];
		long den=fac[n-k]*fac[k];
		long ans=(num*modPow(den%mod,mod-2));
		return ans%mod;
	}

	public static void main(String[] args) throws IOException {
		MScanner sc=new MScanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		fac=new long[(int)2e5+1];
		fac[0]=1;
		for(int i=1;i<fac.length;i++) {
			fac[i]=(fac[i-1]*i)%mod;
		}
		int n=sc.nextInt(),m=sc.nextInt();
		long ans=0;
		for(int top=n-1;top<=m;top++) {
			long ways=nck(top-1, n-2);
			long pair=n-2;
			long waysToChooseLeft=modPow(2, Math.max(0, n-3));
			long inc=(ways*pair)%mod;
			inc=(inc*waysToChooseLeft)%mod;
			ans=(ans+inc)%mod;
		}
		pw.println(ans);

		pw.flush();
	}
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] takearr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] takearrl(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public Integer[] takearrobj(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] takearrlobj(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

import java.io.*;
import java.util.*;

public class CF1312D extends PrintWriter {
	CF1312D() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF1312D o = new CF1312D(); o.main(); o.flush();
	}

	static final int MD = 998244353;
	long power(int a, int k) {
		if (k == 0)
			return 1;
		long p = power(a, k / 2);
		p = p * p % MD;
		if (k % 2 == 1)
			p = p * a % MD;
		return p;
	}
	long choose(int n, int k) {
		return k == 0 ? 1 : choose(n - 1, k - 1) * n % MD * power(k, MD - 2) % MD;
	}
	void main() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		println(n < 3 || m < n - 1 ? 0 : choose(m, n - 1) * (n - 2) % MD * power(2, n - 3) % MD);
	}
}

import java.io.*;
import java.util.*;

public class Main {
    static PrintWriter pw;
    static Scanner sc;
    static long[][] dp;
    static int mod, arr[][];
    static ArrayList<Integer> ans;
    static int[] fact;
    static long ceildiv(long x, long y) { return (x + y - 1) / y; }
    static int mod(long x, int m) { return (int) ((x % m + m) % m); }
    public static long gcd(long x, long y) {return y==0?x:gcd(y, x%y);}
    public static void main(String[] args) throws Exception {
        sc = new Scanner(System.in);
        pw = new PrintWriter(System.out);
        int n=sc.nextInt(), m=sc.nextInt();
        int mod=998244353;
        fact=new int[m+1];
        fact[0]=1;
        for(int i=1; i<=m; i++)
            fact[i]=(int)((fact[i-1]*1l*i)%mod);
        long p=Pow(2, n-3, mod)*1l;
        long c=(comb(m, n-1, mod)*1l*(n-2))%mod;
        pw.println((p*c)%mod);
        pw.close();
    }
    static long Pow(long a, int e, int mod) {
        a %= mod;
        long res = 1;
        while (e > 0) {
            if ((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    }
    static int modInv(int x, int mod){
        return Euclid(x, mod).x;
    }
    static Pair Euclid(int x, int y){
        if(y==0)
            return new Pair(1, 0);
        Pair p=Euclid(y, x%y);
        int a=p.y, b=(int)(p.x-p.y*1l*(x/y));
        return new Pair(a, b);
    }
    static long comb(int n, int r, int mod){
        return (fact[n]*1l*mod(modInv((int)((fact[n-r]*1l*fact[r])%mod), mod), mod))%mod;
    }
    static long solve(int rem, int diff){
        if(diff==0)
            return 1;
        if(rem==0)
            return 1;
        if(dp[rem][diff]==-1){
            long ans=0;
            for(int i=0; i<=diff; i++)
                ans=(ans+solve(rem-1, i)*(diff-i+1))%mod;
            dp[rem][diff]=ans;
        }
        return dp[rem][diff];
    }
    static void printArr(int[] arr) {
        for (int i = 0; i < arr.length - 1; i++)
            pw.print(arr[i] + " ");
        pw.println(arr[arr.length - 1]);
    }
    static void printArr(long[] arr) {
        for (int i = 0; i < arr.length - 1; i++)
            pw.print(arr[i] + " ");
        pw.println(arr[arr.length - 1]);
    }
    static void printArr(Integer[] arr) {
        for (int i = 0; i < arr.length; i++)
            pw.print(arr[i] + " ");
        pw.println();
    }
    static void printArr(char[] arr) {
        for (int i = 0; i < arr.length; i++)
            pw.print(arr[i]==0? '1': arr[i]);
        pw.println();
    }
    static void printArr(ArrayList<Integer> list) {
        for (int i = 0; i < list.size(); i++)
            pw.print(list.get(i)+1+" ");
        pw.println();
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;
        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] nextArr(int n) throws IOException {
            int[] arr = new int[n];
            for (int i = 0; i < arr.length; i++)
                arr[i] = nextInt();
            return arr;
        }
        public Integer[] nextsort(int n) throws IOException{
            Integer[] arr=new Integer[n];
            for(int i=0; i<n; i++)
                arr[i]=nextInt();
            return arr;
        }
        public Pair nextPair() throws IOException{
            return new Pair(nextInt(), nextInt());
        }
        public Pair[] nextPairArr(int n) throws IOException{
            Pair[] arr=new Pair[n];
            for(int i=0; i<n; i++)
                arr[i]=new Pair(nextInt(), nextInt());
            return arr;
        }
        public boolean ready() throws IOException {
            return br.ready();
        }
    }
    static class Pair implements Comparable<Pair>{
        int x;
        int y;
        public Pair(int x, int y) {
            this.x=x;
            this.y=y;
        }
        public int hashCode() {
            return (this.x*1000+this.y);
        }
        public int compareTo(Pair p){
            return -Long.compare(this.x-this.y, p.x-p.y);
        }
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (this.getClass() != obj.getClass()) {
                return false;
            }
            Pair p = (Pair) obj;
            return this.x==p.x && this.y==p.y;
        }
        public boolean equal(Pair p){
            if(this.x==p.x)
                return this.y==p.y;
            if(this.x==p.y)
                return this.y==p.x;
            else
                return false;
        }
        public Pair clone(){
            return new Pair(x, y);
        }
        public String toString(){
            return this.x+" "+this.y;
        }
        public void add(Pair p){
            x+=p.x;
            y+=p.y;
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args)
	{
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);

 		int n =fr.nextInt() ,m =fr.nextInt() ,i ;	long fct[] =new long[m+1] ,md =998244353l ,j ,nm ,den ,l ,ans =0l ;
 		fct[0] =1l ;	for (j =i =1 ; i<=m ; ++i, ++j)	fct[i] =(fct[i-1] * j)%md ;
 		if (n==2l)	op.println("0") ;
 		else {
	 		for (i =n-1 ; i<=m ; ++i) {
	 			nm =fct[i-1] ;	den =(fct[n-2] * fct[i-n+1])%md ;	den =pow (den , md-2l , md) ;
	 			nm =(nm * den)%md ;	ans =(ans+nm)%md ;
	 		}
	 		ans =(ans * (n-2l))%md ;	l =0l ;
	 		for (i =2 ; i<n ; ++i) {
	 			den =fct[i-2] ;	nm =fct[n-3] ;	j =fct[n-i-1] ;
	 			den =(den * j)%md ;	den =pow (den , md-2l , md) ;	nm =(nm * den)%md ;
	 			l =(l + nm)%md ;
	 		}
	 		ans =(ans * l)%md ;	op.println(ans) ;
	 	}
		op.flush();	op.close();
	}
	static long pow (long b , long e , long md) {
		if (e==0l)	return 1l;
		if (e==1l)	return b;
		long dm =pow(b , e/2l , md) ;	dm =(dm*dm)%md ;
		if ((e&1l)==1l)	dm =(dm * b)%md ;
		return dm ;
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements()))
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}

			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next()) ;
		}
	}
}

import java.util.*;
import java.io.*;
public class HelloWorld{

    private static long modInverse(long n, long p){
        return pow(n, p-2, p)%p;
    }

    private static long pow(long n, long p, long mod){
        if(p == 0)  return (long)1;
        if(p == 1)  return (n%mod);

        long ans = pow(n, p/2, mod)%mod;
        ans = (ans%mod * ans%mod)%mod;

        if(p%2 == 1)
            ans = (ans%mod * n%mod)%mod;

        return ans;
    }

    public static void main(String []args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt(), m = sc.nextInt(), lim = Math.max(m, n);

        long mod = 998244353, fact[] = new long[lim+1];

        fact[0] = 1;
        for(int i=1; i<=lim; i++)
            fact[i] = (fact[i-1]%mod * i%mod)%mod;

        long ans = fact[m];
        ans = (ans%mod * modInverse(fact[n-1], mod)%mod)%mod;
        ans = (ans%mod * modInverse(fact[m-n+1], mod)%mod)%mod;
        ans = (ans%mod * pow(2, n-3, mod)%mod)%mod;
        ans = (ans%mod * (n-2)%mod)%mod;

        System.out.println(+ans%mod);
    }
}

/*
[ ( ^ _ ^ ) ]
*/

// problem: cf/1312/D

import java.io.*;
import java.util.*;

public class d {
    int INF = (int)1e9;
    long MOD = 998244353;//1000000007;

    long pow(long a, long n, long mod) {
        if (n == 0) {
            return 1;
        }
        long rs = 1;
        while (n > 0) {
            if (n % 2 == 1) {
                rs *= a;
            }
            rs %= mod;
            n >>= 1;
            a *= a;
            a %= mod;
        }
        return rs;
    }

    long c(int n, int r) {
        long[] f = new long[n+1];
        f[0] = f[1] = 1l;
        for(int i=2; i<=n; i++) {
            f[i] = (f[i-1] * i) % MOD;
        }
        long rs = f[n] * pow( (f[r] * f[n-r]) % MOD, MOD-2, MOD);
        rs %= MOD;
        return rs;
    }

    void solve(InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();

        if(n==2) {
            out.println(0);
            return;
        }

        long rs = (c(m, n-1) * (n-2)) % MOD;
        rs = (rs * pow(2, n-3, MOD)) % MOD;
        out.println(rs);
    }

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new d().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }

    static boolean DEBUG_FLAG = false;
    static void debug(String s) {
        if(DEBUG_FLAG) System.out.print(s);
    }

    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }

    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

import java.io.*;
import java.util.*;

public class Main {
	public static PrintWriter out;
	public static InputReader in;
	public static long pow(long a, long b, long m)
	{
		if(b==0 || b==1)
			return ((long)Math.pow(a,b))%m;
		long half = pow(a,b/(long)2,m);
		return (half*half*(((b&1)==0) ? 1 : a))%m;
	}
	public static long fact(long a, long m)
	{
		long res=1;
		for(long i=a;i>=2;i--)
		{
			res = res*i;
			if(res>=m)
				res%=m;
		}
		return res;
	}
	public static long gcd(long a, long b)
	{
		while(a!=0 && b!=0)
		{
			a=a%b;
			a^=b; b^=a; a^=b;
		}
		return a+b;
	}
	public static void extGCD(long a, long b, long val[])
	{
		if(a==0)
		{
			val[0]=0; val[1]=1; val[2]=b;
			return;
		}
		extGCD(b%a,a,val);
		long v2 = val[0];
		long v1 = val[1]-(val[0]*(b/(long)a));
		val[0]=v1; val[1]=v2;
	}
	public static long inv(long a, long m)
	{
		long val[] = new long[3];
		extGCD(a,m,val);
		return val[0];
	}
	public static long div(long a, long b, long m)
	{
		long binv = (inv(b,m)+m)%m;
		return (a*binv)%m;
	}
	public static long ncr(long n, long r, long m)
	{
		long num = fact(n,m);
		long denom = (fact(n-r,m)*fact(r,m))%m;
		// out.println("num:"+num+",denom:"+denom);
		return div(num,denom,m);
	}
	public static void main(String[] args)throws IOException {
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);
		long n = in.nextLong();
		long m = in.nextLong();
		long mod = 998244353;
		long ans = pow(2,n-3,mod);
		ans = (ans*ncr(m,n-1,mod))%mod;
		ans = (ans*(n-2))%mod;
		out.println(ans);
		// out.println(ncr(5,2,10000));
		out.close();
	}
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

	//static int p = 1000000007;
	static int p = 998244353;

	public static void main(String args[]) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		Mod mod = new Mod();
		mod.precalc();

		int t = 1;
		//t = sc.nextInt();

		while (t-- > 0) {

			int n = sc.nextInt(), m=sc.nextInt();
			int ans = 1;
			if(n==2) {
				out.print(0);
				break;
			}
			ans = mod.mul(mod.C(m, n-1), mod.mul(n-2, mod.binpow(2, n-3)));
			out.print(ans);
		}
		out.flush();
	}

	static int count(int x, int[] arr) {
		int count = 0;

		for (int i = 0; i < arr.length; i++)
			if (arr[i] == x)
				count++;
		return count;
	}

	public static String reverseString(String str) {
		StringBuilder sb = new StringBuilder(str);
		sb.reverse();
		return sb.toString();
	}

	static boolean isPalindrome(String str) {
		int i = 0, j = str.length() - 1;

		while (i < j) {

			if (str.charAt(i) != str.charAt(j))
				return false;

			i++;
			j--;
		}
		return true;
	}

	static void print(int[] arr) {
		for (int i = 0; i < arr.length; i++)
			System.out.print(arr[i] + " ");
		System.out.println();
	}

	public static int abs(int x) {
		return ((x > 0) ? x : -x);
	}

	public static long abs(long x) {
		return ((x > 0) ? x : -x);
	}

	public static int max(int a, int b) {
		return Math.max(a, b);
	}

	public static long max(long a, long b) {
		return Math.max(a, b);
	}

	public static int min(int a, int b) {
		return Math.min(a, b);
	}

	public static long min(long a, long b) {
		return Math.min(a, b);
	}

	static int gcd(int a, int b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	static int modInverse(int a, int m) {
		int g = gcd(a, m);
		if (g != 1)
			return -1;
		else
			return power(a, m - 2, m);

	}

	// To compute x^y under modulo m
	static int power(int x, int y, int m) {
		if (y == 0)
			return 1;

		int p = power(x, y / 2, m) % m;
		p = (p * p) % m;

		if (y % 2 == 0)
			return p;
		else
			return (x * p) % m;
	}

	static int[] primeGenerator(int num) {
		int length = 0, arr[] = new int[num], a = num, factor = 1;
		if (num % 2 == 0) {
			while (num % 2 == 0) {
				num /= 2;
				factor *= 2;
			}
			arr[length++] = factor;
		}
		for (int i = 3; i * i <= a; i++) {
			factor = 1;
			if (num % i == 0) {
				while (num % i == 0) {
					num /= i;
					factor *= i;
				}
				arr[length++] = factor;
			}
		}
		if (num > 1)
			arr[length++] = num;
		return Arrays.copyOfRange(arr, 0, length);
	}

	static boolean isPrime(int n) {
		// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		// This is checked so that we can skip
		// middle five numbers in below loop
		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}

	  static class Scanner { BufferedReader br; StringTokenizer st;

	 Scanner() { br = new BufferedReader(new InputStreamReader(System.in)); }

	  Scanner(String fileName) throws FileNotFoundException { br = new
	  BufferedReader(new FileReader(fileName)); }

	  String next() throws IOException { while (st == null || !st.hasMoreTokens())
	  st = new StringTokenizer(br.readLine()); return st.nextToken(); }

	  String nextLine() throws IOException { return br.readLine(); }

	  int nextInt() throws IOException { return Integer.parseInt(next()); }

	  long nextLong() throws NumberFormatException, IOException { return
	  Long.parseLong(next()); }

	  double nextDouble() throws NumberFormatException, IOException { return
	  Double.parseDouble(next()); }

	  boolean ready() throws IOException { return br.ready(); }

	  }

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}
}

class Pair {
	int x;
	int y;

	Pair(int a, int b) {
		x = a;
		y = b;
	}

	void print() {
		System.out.println(this.x + " " + this.y);
	}
}

class Mod{
	static final int MOD = 998244353;

	int add(int x, int y){
		x += y;
	    while(x >= MOD) x -= MOD;
	    while(x < 0) x += MOD;
	    return x;
	}

	int subtract(int x, int y) {
		x -= y;
	    while(x >= MOD) x -= MOD;
	    while(x < 0) x += MOD;
	    return x;
	}

	int mul(int x, int y)
	{
		int result = (int)((long)x*y % MOD);
	    return result>=0?result:result+MOD;
	}

	int binpow(int x, int y)
	{
	    int z = 1;
	    while(y!=0)
	    {
	        if((y & 1)!=0)
	        	z = mul(z, x);
	        x = mul(x, x);
	        y >>= 1;
	    }
	    return z;
	}

	int inv(int x)
	{
	    return binpow(x, MOD - 2);
	}

	int divide(int x, int y)
	{
	    return mul(x, inv(y));
	}

	static final int N =200043;
	int[] fact;

	Mod() {
		fact = new int[N];
	}

	void precalc()
	{
	    fact[0] = 1;
	    for(int i = 1; i < N; i++)
	        fact[i] = mul(fact[i - 1], i);
	}

	int C(int n, int k)
	{
	    return divide(fact[n], mul(fact[k], fact[n - k]));
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
import java.util.function.*;
import java.util.stream.*;

public class D {

    private static final FastReader in = new FastReader();
    private static final FastWriter out = new FastWriter();

    public static void main(String[] args) {
        new D().run();
    }

    private void run() {
        var t = 1;
        while (t-- > 0) {
            solve();
        }

        out.flush();
    }

    Modulo mod = new Modulo(998244353);
    long[] p;

    private void solve() {
        var n = in.nextInt();
        var m = in.nextInt();

        p = new long[m + 1];
        p[0] = 1l;
        for (var i = 1; i <= m; i++) {
            p[i] = mod.multiply(p[i - 1], i);
        }

        var ans = mod.multiply(mod.multiply(mod.power(2l, n - 3), n - 2), c(m, n - 1));
        out.println(ans);
    }

    private long c(int n, int m) {
        var a = p[n];
        var b = mod.multiply(p[m], p [n - m]);
        return mod.divide(a, b);
    }

}

class FastReader {

    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer in;

    public String next() {
        while (in == null || !in.hasMoreTokens()) {
            try {
                in = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                return null;
            }
        }
        return in.nextToken();
    }

    public BigDecimal nextBigDecimal() {
        return new BigDecimal(next());
    }

    public BigInteger nextBigInteger() {
        return new BigInteger(next());
    }

    public boolean nextBoolean() {
        return Boolean.valueOf(next());
    }

    public byte nextByte() {
        return Byte.valueOf(next());
    }

    public double nextDouble() {
        return Double.valueOf(next());
    }

    public double[] nextDoubleArray(int length) {
        var a = new double[length];
        for (var i = 0; i < length; i++) {
            a[i] = nextDouble();
        }
        return a;
    }

    public int nextInt() {
        return Integer.valueOf(next());
    }

    public int[] nextIntArray(int length) {
        var a = new int[length];
        for (var i = 0; i < length; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    public long nextLong() {
        return Long.valueOf(next());
    }

    public long[] nextLongArray(int length) {
        var a = new long[length];
        for (var i = 0; i < length; i++) {
            a[i] = nextLong();
        }
        return a;
    }

}

class FastWriter extends PrintWriter {

    public FastWriter() {
        super(System.out);
    }

    public void println(double[] a) {
        for (var i = 0; i < a.length; i++) {
            print(a[i]);
            print(i + 1 < a.length ? ' ' : '\n');
        }
    }

    public void println(int[] a) {
        for (var i = 0; i < a.length; i++) {
            print(a[i]);
            print(i + 1 < a.length ? ' ' : '\n');
        }
    }

    public void println(long[] a) {
        for (var i = 0; i < a.length; i++) {
            print(a[i]);
            print(i + 1 < a.length ? ' ' : '\n');
        }
    }

    public <T> void println(T[] a) {
        for (var i = 0; i < a.length; i++) {
            print(a[i]);
            print(i + 1 < a.length ? ' ' : '\n');
        }
    }

    public <T> void println(List<T> l) {
        println(l.toArray());
    }

    public void debug(String name, Object o) {
        String value = Arrays.deepToString(new Object[] { o });
        value = value.substring(1, value.length() - 1);
        System.err.println(name + " => " + value);
    }

}

// all a, b < mod
class Modulo {

    private final long mod;

    public Modulo(long mod) {
        this.mod = mod;
    }

    // a + b
    public long add(long a, long b) {
        var c = a + b;
        if (c >= mod) {
            c -= mod;
        }
        return c;
    }

    // a - b
    public long subtract(long a, long b) {
        var c = a - b;
        if (c < 0) {
            c += mod;
        }
        return c;
    }

    // a * b
    public long multiply(long a, long b) {
        return a * b % mod;
    }

    // a ^ b
    public long power(long a, long b) {
        long c = 1;

        while (b > 0) {
            if ((b & 1) > 0) {
                c = c * a % mod;
            }
            a = a * a % mod;
            b >>= 1;
        }

        return c;
    }

    // a / b
    public long divide(long a, long b) {
        return multiply(a, power(b, mod - 2));
    }

}

//make sure to make new file!
import java.io.*;
import java.util.*;

public class D83{

   public static long MOD = 998244353;

   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);

      StringTokenizer st = new StringTokenizer(f.readLine());

      long n = Long.parseLong(st.nextToken());
      long m = Long.parseLong(st.nextToken());

      long answer = nCrModPFermat(m,n-1,MOD);
      answer = (answer * (n-2) + MOD)%MOD;

      long pow2 = 1L;
      for(int k = 1; k <= n-3; k++){
         pow2 = (pow2*2+MOD)%MOD;
      }

      answer = (answer * pow2 + MOD)%MOD;

      out.println(answer);

      out.close();
   }

   /* Iterative Function to calculate
    (x^y)%p in O(log y) FROM GEEKS FOR GEEKS  */
   public static long power(long x, long y, long p)
   {

        // Initialize result
      long res = 1;

        // Update x if it is more than or
        // equal to p
      x = x % p;

      while (y > 0)
      {

            // If y is odd, multiply x
            // with result
         if (y % 2 == 1)
            res = (res * x) % p;

            // y must be even now
         y = y >> 1; // y = y/2
         x = (x * x) % p;
      }

      return res;
   }

    // Returns n^(-1) mod p
   public static long modInverse(long n, long p)
   {
      return power(n, p-2, p);
   }

    // Returns nCr % p using Fermat's
    // little theorem.
   public static long nCrModPFermat(long n, long r,
                                    long p)
   {

        // Base case
      if (r == 0)
         return 1;

        // Fill factorial array so that we
        // can find all factorial of r, n
        // and n-r
      long[] fac = new long[(int)n+1];
      fac[0] = 1;

      for (int i = 1 ;i <= n; i++)
         fac[i] = fac[i-1] * i % p;

      return (fac[(int)n]* modInverse(fac[(int)r], p)
                % p * modInverse(fac[(int)(n-r)], p)
                                    % p) % p;
   }

}

import java.io.*;
import java.util.*;
public class Main
{
	final long mod=998244353;
	private void solve()throws IOException
	{
		fact();
		int n=nextInt();
		int m=nextInt();
		long ans=0;
		for(int i=2;i<=m;i++)
		{
			if(m-1>=n-2)
				ans=(ans+(((choose(m-1,n-2)-choose(m-i,n-2)+mod)%mod)*modpow(2,n-3))%mod)%mod;
		}
		out.println(ans);
	}
	long choose(int n,int r)
	{
		if(n<r)
			return 0;
		return (((fact[n]*modinv(fact[r]))%mod)*modinv(fact[n-r]))%mod;
	}
	final int maxn=(int)(2e5);
	long fact[];
	void fact(){
		fact=new long[maxn+1];
		fact[0]=1;
		for(int i=1;i<=maxn;i++)
			fact[i]=(fact[i-1]*i)%mod;
	}
	long modinv(long x){
	    return modpow(x,mod-2);
	}
	long modpow(long a,long b){
	    long ret=1;
	    while(b!=0)
	    {
	        if(b%2==1)
	            ret=(ret*a)%mod;
	        a=(a*a)%mod;
	        b=b/2;
	    }
	    return ret;
	}

	///////////////////////////////////////////////////////////

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();

		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DCountTheArrays solver = new DCountTheArrays();
        solver.solve(1, in, out);
        out.close();
    }

    static class DCountTheArrays {
        long mod = 998244353l;
        long[] fac;

        long ncr(long n, long r) {
            if (r > n) return 0;
            if (r == 0) return 1;
            long up = fac[(int) n];
            long down = (fac[(int) (n - r)] * fac[(int) r]) % mod;
            return (up * CodeX.modinv(down, mod)) % mod;
        }

        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int m = in.scanInt();
            fac = new long[200005];
            fac[0] = fac[1] = 1;
            for (int i = 2; i < fac.length; i++) fac[i] = (fac[i - 1] * i) % mod;
            if (n > m + 1) {
                out.println(0);
                return;
            } else {
                if (n == 2) {
                    out.println(0);
                    return;
                } else {
                    long ans = ncr(m, n - 1);
                    ans = (ans * CodeX.power(2, n - 2, mod)) % mod;
                    ans = (ans * (n - 2)) % mod;
                    ans = (ans * CodeX.modinv(2, mod)) % mod;
                    out.println(ans);
                }
            }
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }

    static class CodeX {
        public static long power(long x, long y, long p) {
            long res = 1;
            x = x % p;
            while (y > 0) {

                if ((y & 1) != 0)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }

        public static long modinv(long k, long mod) {
            return power(k, mod - 2, mod);
        }

    }
}

import java.io.*;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.BinaryOperator;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    private final static long mod = 998244353;

    private final static int MAXN = 1000001;

    private static long power(long x, long y, long m) {
        long temp;
        if (y == 0)
            return 1;
        temp = power(x, y / 2, m);
        temp = (temp * temp) % m;
        if (y % 2 == 0)
            return temp;
        else
            return ((x % m) * temp) % m;
    }

    private static long power(long x, long y) {
        return power(x, y, mod);
    }

    private static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    static int nextPowerOf2(int a) {
        return 1 << nextLog2(a);
    }

    static int nextLog2(int a) {
        return (a == 0 ? 0 : 32 - Integer.numberOfLeadingZeros(a - 1));
    }

    private static long modInverse(long a, long m) {
        long m0 = m;
        long y = 0, x = 1;
        if (m == 1)
            return 0;
        while (a > 1) {
            long q = a / m;
            long t = m;
            m = a % m;
            a = t;
            t = y;
            y = x - q * y;
            x = t;
        }
        if (x < 0)
            x += m0;
        return x;
    }

    private static int[] getLogArr(int n) {
        int arr[] = new int[n + 1];
        for (int i = 1; i < n + 1; i++) {
            arr[i] = (int) (Math.log(i) / Math.log(2) + 1e-10);
        }
        return arr;
    }

    private static int log[] = getLogArr(MAXN);

    private static int getLRSpt(int st[][], int L, int R, BinaryOperator<Integer> binaryOperator) {
        int j = log[R - L + 1];
        return binaryOperator.apply(st[L][j], st[R - (1 << j) + 1][j]);
    }

    private static int[][] getSparseTable(int array[], BinaryOperator<Integer> binaryOperator) {
        int k = log[array.length+1] + 1;
        int st[][] = new int[array.length+1][k + 1];

        for (int i = 0; i < array.length; i++)
            st[i][0] = array[i];

        for (int j = 1; j <= k; j++) {
            for (int i = 0; i + (1 << j) <= array.length; i++) {
                st[i][j] = binaryOperator.apply(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]);
            }
        }
        return st;
    }

    static class Subset {
        int parent;
        int rank;

        @Override
        public String toString() {
            return "" + parent;
        }
    }

    static int find(Subset[] Subsets, int i) {
        if (Subsets[i].parent != i)
            Subsets[i].parent = find(Subsets, Subsets[i].parent);
        return Subsets[i].parent;
    }

    static void union(Subset[] Subsets, int x, int y) {
        int xroot = find(Subsets, x);
        int yroot = find(Subsets, y);

        if (Subsets[xroot].rank < Subsets[yroot].rank)
            Subsets[xroot].parent = yroot;
        else if (Subsets[yroot].rank < Subsets[xroot].rank)
            Subsets[yroot].parent = xroot;
        else {
            Subsets[xroot].parent = yroot;
            Subsets[yroot].rank++;
        }
    }

    private static int maxx(Integer... a) {
        return Collections.max(Arrays.asList(a));
    }

    private static int minn(Integer... a) {
        return Collections.min(Arrays.asList(a));
    }

    private static long maxx(Long... a) {
        return Collections.max(Arrays.asList(a));
    }

    private static long minn(Long... a) {
        return Collections.min(Arrays.asList(a));
    }

    private static class Pair<T, U> implements Comparable<Pair<T, U>>{
        T a;
        U b;

        public Pair(T a, U b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Pair pair = (Pair) o;
            return a.equals(pair.a) &&
                    b.equals(pair.b);
        }

        @Override
        public int hashCode() {
            return Objects.hash(a, b);
        }

        @Override
        public String toString() {
            return "(" + a +
                    "," + b +
                    ')';
        }

        @Override
        public int compareTo(Pair<T, U> o) {
            return (int)(this.a.equals(o.a)?
                    this.b.equals(o.b)?0:((Integer)this.b-(Integer)o.b)/Math.abs((Integer)this.b-(Integer)o.b):
                    ((Integer)this.a-(Integer)o.a)/Math.abs((Integer)this.a-(Integer)o.a));
        }
    }

    private static boolean isPrimeAKS(long n) {
        if(n%mod==0||n<2) return false;
        if(n>2&&n%2==0)return false;
        return (power((mod-1),n, n)==(power(mod,n,n)-1+n)%n);
    }

    public static int upperBound(List<Integer> list, int value) {
        int low = 0;
        int high = list.size();
        while (low < high) {
            final int mid = (low + high) / 2;
            if (value >= list.get(mid)) {
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        return low;
    }

    private static int[] getLPSArray(String pattern) {
        int i,j,n=pattern.length();
        int[] lps = new int[pattern.length()];
        lps[0]=0;
        for(i=1,j=0;i<n;){
            if(pattern.charAt(i)==pattern.charAt(j)) {
                lps[i++]=++j;
            }
            else if(j>0){
                j=lps[j-1];
            }
            else {
                lps[i++]=0;
            }
        }
        return lps;
    }

    private static List<Integer> findPattern(String text, String pattern) {
        List<Integer> matchedIndexes = new ArrayList<>();
        if(pattern.length()==0) {
            return matchedIndexes;
        }
        int[] lps = getLPSArray(pattern);
        int i=0,j=0,n=text.length(),m=pattern.length();
        while(i<n) {
            if(text.charAt(i)==pattern.charAt(j)) {
                i++;
                j++;
            }
            if (j == m) {
                matchedIndexes.add(i - j);
                j = lps[j - 1];
            }
            if(i<n&&text.charAt(i)!=pattern.charAt(j)) {
                if (j > 0) {
                    j = lps[j - 1];
                } else {
                    i++;
                }
            }
        }
        return matchedIndexes;
    }

    private static Set<Long> getDivisors(long n) {
        Set<Long> divisors = new HashSet<>();
        divisors.add(1L);
        divisors.add(n);
        for (long i = 2; i <= Math.sqrt(n); i++) {
            if (n % i == 0) {
                divisors.add(i);
                divisors.add(n / i);
            }
        }
        return divisors;
    }

    private static long getLCM(long a, long b) {
        return (Math.max(a,b)/gcd(a,b))*Math.min(a,b);
    }

    static long fac[]=new long[2000005];
    static long ifac[]=new long[2000005];

    private static void preCompute(int n){
        fac=new long[n+1];
        ifac=new long[n+1];
        fac[0]=ifac[0]=fac[1]=ifac[1]=1;
        int i;
        for(i=2;i<n+1;i++){
            fac[i]=(i*fac[i-1])%mod;
            ifac[i]=(power(i,mod-2)*ifac[i-1])%mod;
        }
    }

    private static long C(int n,int r){
        if(n<0||r<0)return 1;
        if(r>n) return 1;
        return (fac[n]*((ifac[r]*ifac[n-r])%mod))%mod;
    }

    private static void reverse(int []arr, int l,int r){

        while(l<r){
            int tmp=arr[l];
            arr[l]=arr[r];
            arr[r]=tmp;
            l++;
            r--;
        }
    }

    public static long countArrays(int n, int m) {
        long ans = (
                (
                        (
                                C(m, n-1)
                                        *
                                        (n-2)
                        )%mod
                )*power(2,n-3)
        )%mod;
        return ans;
    }

    public static void main(String[] args) throws Exception {

        long START_TIME = System.currentTimeMillis();
        try (FastReader in = new FastReader();
             FastWriter out = new FastWriter()) {

            int t, i, j, n, k, l, r,m, ti, tidx,gm,mx,mn,q,g;

            //for (t = in.nextInt(), tidx = 1; tidx <= t; tidx++)a
            {
                long w,x=0, y=0, z=0,sum=0,bhc=0,ans=0;
                //out.print(String.format("Case #%d: ", tidx));
                n=in.nextInt();
                m=in.nextInt();
                preCompute(m);
                out.println(countArrays(n,m));
            }
            if(args.length>0 && "ex_time".equals(args[0])) {
                out.print("\nTime taken: ");
                out.println(System.currentTimeMillis()-START_TIME);
            }
            out.commit();
        } catch (Exception e){
            e.printStackTrace();
        }
    }

    public static class FastReader implements Closeable {
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        private StringTokenizer st;

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArr(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }
        Integer[] nextIntegerArr(int n) {
            Integer[] arr = new Integer[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        double[] nextDoubleArr(int n) {
            double[] arr = new double[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextDouble();
            }
            return arr;
        }

        long[] nextLongArr(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        String[] nextStrArr(int n) {
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = next();
            }
            return arr;
        }

        long[][] nextLongArr2(int n, int m) {
            long[][] arr = new long[n][m];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLongArr(m);
            }
            return arr;
        }

        @Override
        public void close() throws IOException {
            br.close();
        }
    }

    public static class FastWriter implements Closeable {
        BufferedWriter bw;
        StringBuilder sb = new StringBuilder();
        List<String> list = new ArrayList<>();
        Set<String> set = new HashSet<>();

        public FastWriter() {
            bw = new BufferedWriter(new OutputStreamWriter(System.out));
        }

        <T> void commit() throws IOException {
            bw.write(sb.toString());
            bw.flush();
            sb = new StringBuilder();
        }

        public <T> void print(T obj) throws IOException {
            sb.append(obj.toString());
        }

        public void println() throws IOException {
            print("\n");
        }

        public <T> void println(T obj) throws IOException {
            print(obj.toString() + "\n");
        }

        <T> void printArrLn(T[] arr) throws IOException {
            for (int i = 0; i < arr.length - 1; i++) {
                print(arr[i] + " ");
            }
            println(arr[arr.length - 1]);
        }

        <T> void printArr2(T[][] arr) throws IOException {
            for (int j = 0; j < arr.length; j++) {
                for (int i = 0; i < arr[j].length - 1; i++) {
                    print(arr[j][i] + " ");
                }
                println(arr[j][arr.length - 1]);
            }
        }

        <T> void printColl(Collection<T> coll) throws IOException {
            for (T e : coll) {
                print(e + " ");
            }
            println();
        }

        void printCharN(char c, int n) throws IOException {
            for (int i = 0; i < n; i++) {
                print(c);
            }
        }

        void printIntArr2(int[][] arr) throws IOException {
            for (int j = 0; j < arr.length; j++) {
                for (int i = 0; i < arr[j].length - 1; i++) {
                    print(arr[j][i] + " ");
                }
                println(arr[j][arr.length - 1]);
            }
        }

        @Override
        public void close() throws IOException {
            bw.close();
        }
    }

}

import java.io.*;
import java.util.*;

public class Q1 {

    static int mod = 998244353;

    static long power(long x, long y) {
        if (y == 0)
            return 1;
        long num = power(x, y / 2) % mod;
        long val = (num * num) % mod;
        return y%2==0?val:(val*x)%mod;
    }

    public static void main(String[] args) {

        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);

        int n = in.nextInt(), m = in.nextInt();

        long fact[] = new long[ 200000+10];
        fact[0]=fact[1] = 1;
        for (int i = 2; i <fact.length; i++)
            fact[i] = (i * fact[i - 1] ) % mod;

        long ans = ((((((fact[m]*power(fact[n-1],mod-2))%mod *(power(fact[m-n+1],mod-2)%mod))%mod )  *  (n-2)%mod)%mod )*(power(2,n-3)%mod))%mod;

     //   long ans =    ((((((fact[m] * power(fact[n - 1], mod - 2)) % mod) * power(fact[m - n + 1], mod - 2)) % mod) * (n - 2))%mod) * power(2l, n - 3) % mod;

        out.println(ans);

        out.close();

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public int[] shuffle(int[] arr) {
            Random r = new Random();
            for (int i = 1, j; i < arr.length; i++) {
                j = r.nextInt(i);
                arr[i] = arr[i] ^ arr[j];
                arr[j] = arr[i] ^ arr[j];
                arr[i] = arr[i] ^ arr[j];
            }
            return arr;
        }

        public InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public char nextChar() {
            return next().charAt(0);
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }

}

import java.io.*;
import java.util.*;

public class D implements Runnable {
	boolean judge = false;
	FastReader scn;
	PrintWriter out;
	String INPUT = "";

	long[] fact = new long[200002];
	long[] ifact = new long[fact.length];
	int mod = 998244353;

	void solve() {
		int n = scn.nextInt(), m = scn.nextInt();

		fact[0] = 1;
		for (int i = 1; i < fact.length; i++) {
			fact[i] = (i * fact[i - 1]) % mod;
		}

		ifact[fact.length - 1] = pow(fact[fact.length - 1], mod - 2, mod);
		for (int i = fact.length - 2; i >= 0; i--) {
			ifact[i] = (ifact[i + 1] * (i + 1)) % mod;
		}

		long need = 0;
		for(int i = 2; i < n; i++) {
			need += ifact[i - 2] * ifact[n - i - 1] % mod;
			need %= mod;
		}

		long ans = 0;
		for(int k = 2; k <= m; k++) {
			if(k - 2 < 0 || k - n + 1 < 0 || k - n + 1 >= fact.length) {
				continue;
			}
			long X = need;

			X = X * (k - 1) % mod;
			X = ((X * fact[k - 2]) % mod * ifact[k - n + 1]) % mod;
			ans += X;
			ans %= mod;
		}
		out.println(ans);
	}

	long ncr(int n, int r) {
		if(r > n) {
			return 0;
		}
		return ((fact[n] * ifact[r]) % mod * ifact[n - r]) % mod;
	}

	long pow(long a, long x, long m) {
		long rv = 1;
		while (x != 0) {
			if ((x & 1) == 1) {
				rv = (rv * a) % m;
			}
			a = (a * a) % m;
			x = x >> 1;
		}
		return rv;
	}

	public void run() {
		long time = System.currentTimeMillis();
		boolean oj = System.getProperty("ONLINE_JUDGE") != null || judge;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

	public static void main(String[] args) {
		new Thread(null, new D(), "Main", 1 << 28).start();
	}

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		char nextChar() {
			return (char) skip();
		}

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		int[] shuffle(int[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				int c = arr[i];
				arr[i] = arr[j];
				arr[j] = c;
			}
			return arr;
		}

		long[] shuffle(long[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				long c = arr[i];
				arr[i] = arr[j];
				arr[j] = c;
			}
			return arr;
		}

		int[] uniq(int[] arr) {
			arr = scn.shuffle(arr);
			Arrays.sort(arr);
			int[] rv = new int[arr.length];
			int pos = 0;
			rv[pos++] = arr[0];
			for (int i = 1; i < arr.length; i++) {
				if (arr[i] != arr[i - 1]) {
					rv[pos++] = arr[i];
				}
			}
			return Arrays.copyOf(rv, pos);
		}

		long[] uniq(long[] arr) {
			arr = scn.shuffle(arr);
			Arrays.sort(arr);
			long[] rv = new long[arr.length];
			int pos = 0;
			rv[pos++] = arr[0];
			for (int i = 1; i < arr.length; i++) {
				if (arr[i] != arr[i - 1]) {
					rv[pos++] = arr[i];
				}
			}
			return Arrays.copyOf(rv, pos);
		}

		int[] reverse(int[] arr) {
			int l = 0, r = arr.length - 1;
			while (l < r) {
				arr[l] = arr[l] ^ arr[r];
				arr[r] = arr[l] ^ arr[r];
				arr[l] = arr[l] ^ arr[r];
				l++;
				r--;
			}
			return arr;
		}

		long[] reverse(long[] arr) {
			int l = 0, r = arr.length - 1;
			while (l < r) {
				arr[l] = arr[l] ^ arr[r];
				arr[r] = arr[l] ^ arr[r];
				arr[l] = arr[l] ^ arr[r];
				l++;
				r--;
			}
			return arr;
		}

		int[] compress(int[] arr) {
			int n = arr.length;
			int[] rv = Arrays.copyOf(arr, n);
			rv = uniq(rv);
			for (int i = 0; i < n; i++) {
				arr[i] = Arrays.binarySearch(rv, arr[i]);
			}
			return arr;
		}

		long[] compress(long[] arr) {
			int n = arr.length;
			long[] rv = Arrays.copyOf(arr, n);
			rv = uniq(rv);
			for (int i = 0; i < n; i++) {
				arr[i] = Arrays.binarySearch(rv, arr[i]);
			}
			return arr;
		}
	}
}

import java.util.*;
import java.io.*;

public class File {

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}

			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

		int n = sc.nextInt(); // Number of elements.
		int m = sc.nextInt(); // Max value of an element.

		// No arrays possible with less than 3 elements.
		if (n < 3) {
			out.println(0);
			out.close();
			return;
		}

		long mod = 998244353L;

		int N = 400005;

		long[] fact = new long[N];
		long[] infact = new long[N];

		// n Choose k
		// = n! / k! * (n-k)!
		// = fact[n] * infact[k] * infact[n-k]
		fact[0] = 1L;
		infact[0] = 1L;

		for (int i = 1; i < N; i++) {
			fact[i] = (((fact[i-1]) * i) % mod);
			infact[i] = ((infact[i-1]) * pow(i, mod - 2, mod) % mod);
		}

		// (m Choose n-1) * (n - 2) * (2 ^ (n-3))
		long total = C(m, n - 1, mod, fact, infact) * ((long)n - 2) % mod;
		long p = pow(2, (long)n - 3, mod) % mod;

		long result = (total * p) % mod;

		out.println(result);
		out.close();
	}

	public static long pow(long n, long k, long mod) {
		if (k == 0) {
			return 1L;
		}
		if (k == 1) {
			return n;
		}

		long half = pow(n, k/2, mod) % mod;

		if (k % 2 == 0) {
			return (half * half) % mod;
		}
		else {
			return (((half * half) % mod) * n) % mod;
		}
	}

	public static long C(int n, int k, long mod, long[] fact, long[] infact) {
		long res = (fact[n] * infact[k]) % mod;
		res = (res * infact[n-k]) % mod;
		return res;
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Rustam Musin (t.me/musin_acm)
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    OutputWriter out = new OutputWriter(outputStream);
    DPoschitaiteMassivi solver = new DPoschitaiteMassivi();
    solver.solve(1, in, out);
    out.close();
  }

  static class DPoschitaiteMassivi {
    int mod = 998244353;
    int[] fact;
    int[] p2;

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      init();
      int n = in.readInt();
      int m = in.readInt();
      int ans = solve(n, m);
      out.print(ans);
    }

    int add(int a, int b) {
      int c = a + b;
      if (c >= mod) {
        c -= mod;
      }
      return c;
    }

    int mul(int a, int b) {
      long c = a * (long) b;
      return (int) (c % mod);
    }

    void init() {
      int n = (int) 2e5 + 100;
      fact = new int[n];
      fact[0] = 1;
      for (int i = 1; i < n; i++) {
        fact[i] = mul(fact[i - 1], i);
      }
      p2 = new int[n];
      p2[0] = 1;
      for (int i = 1; i < n; i++) {
        p2[i] = mul(p2[i - 1], 2);
      }
    }

    int pow(int x, int p) {
      if (p == 0) {
        return 1;
      }
      int r = pow(x, p / 2);
      r = mul(r, r);
      if (p % 2 == 1) {
        r = mul(r, x);
      }
      return r;
    }

    int inv(int x) {
      return pow(x, mod - 2);
    }

    int c(int n, int k) {
      if (n < k) {
        return 0;
      }
      return mul(fact[n], inv(mul(fact[k], fact[n - k])));
    }

    int solve(int n, int m) {
      int totalCount = c(m, n - 1);
      int answer = 0;
      for (int i = 1; i <= n - 2; i++) {
        int lowerCount = i - 1;
        int indep = n - 2 - i;
        int s = mul(p2[lowerCount], p2[indep]);
        answer = add(answer, s);
      }
      return mul(answer, totalCount);
    }

  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void close() {
      writer.close();
    }

    public void print(int i) {
      writer.print(i);
    }

  }

  static class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private InputReader.SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public int readInt() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);

    }

  }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            long mod = 998244353;
            if (n == 2) {
                out.println(0);
                return;
            }
            long mafact = 1;
            long nfact = 1;
            long subfact = 1;
            for (int i = 1; i <= m; i++) {
                mafact *= i;
                mafact %= mod;
            }
            for (int i = 1; i <= n - 1; i++) {
                nfact *= i;
                nfact %= mod;
            }
            for (int i = 1; i <= m - n + 1; i++) {
                subfact *= i;
                subfact %= mod;
            }
            long den = (subfact * nfact) % mod;
            long inv = Maths.power(den, mod - 2, mod);
            long nc = (mafact * inv) % mod;
            nc = (nc * (n - 2)) % mod;
            long mul = Maths.power(2, n - 3, mod);
            nc = (nc * mul) % mod;
            out.println(nc);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class Maths {
        static long power(long x, long y, long p) {
            long 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;
        }

    }
}

import java.io.*;
import java.util.Arrays;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.lang.Math.min;

public class Main
{
    boolean multiple = false;
    long MOD = 998244353;

    @SuppressWarnings("Duplicates")
    void solve() throws Exception
    {
        long n = sc.nextLong();
        long m = sc.nextLong();
        long ans = nck(m, n - 1) % MOD;
        ans = (ans * (n - 2)) % MOD;
        long curr = 1;
        for (int i = 1; i <= n - 3; i++)
            curr = (curr * 2) % MOD;
        ans = (ans * curr) % MOD;

        System.out.println(ans);
    }

    long nck(long n, long k)
    {
        return (((f(n) * inv(f(k), MOD)) % MOD) * inv(f(n - k), MOD)) % MOD;
    }

    long f(long n)
    {
        if (n <= 1) return 1;
        return (n * f(n - 1)) % MOD;
    }

    long inv(long a, long b) { return 1 < a ? b - inv(b % a, a) * b / a : 1; }
    long gcd(long a, long b) { return a == 0 ? b : gcd(b % a, a); }
    long powmod(long x, long pow) { if (pow == 0) return 1L;long temp = powmod(x,pow / 2);if (pow % 2 == 0) return (temp * temp) % MOD;return (((x * temp) % MOD) * temp) % MOD; }
    long lcm(long a, long b) { return (a * b) / gcd(a , b); }
    <T> void printarr(T[] arr) { for (T t : arr) System.out.print(t + " ");System.out.println(); }
    TreeMap<Integer, TreeSet<Integer>> buildGraph(int n, int m) throws Exception{TreeMap<Integer, TreeSet<Integer>> graph = new TreeMap<>();for (int i = 1; i <= n; i++) graph.put(i, new TreeSet<>());for (int i = 0; i < m; i++) { int u = sc.nextInt();int v = sc.nextInt();graph.get(u).add(v);graph.get(v).add(u); }return graph; }
    TreeMap<Integer, TreeSet<Integer>> buildDirGraph(int n, int m) throws Exception { TreeMap<Integer, TreeSet<Integer>> graph = new TreeMap<>();for (int i = 1; i <= n; i++) graph.put(i, new TreeSet<>());for (int i = 0; i < m; i++) graph.get(sc.nextInt()).add(sc.nextInt());return graph; }
    TreeMap<Integer, TreeSet<Integer>> revGraph(TreeMap<Integer, TreeSet<Integer>> graph) { TreeMap<Integer, TreeSet<Integer>> rev = new TreeMap<>();for (Integer u : graph.keySet()) rev.put(u, new TreeSet<>());for (Integer u : graph.keySet()) for (Integer v : graph.get(u)) rev.get(v).add(u);return rev; }
    int[] iarr(int n) throws Exception { int[] a = new int[n];for (int i = 0; i < n; i++) a[i] = sc.nextInt();return a; }
    Integer[] Iarr(int n) throws Exception { Integer[] a = new Integer[n];for (int i = 0; i < n; i++) a[i] = sc.nextInt();return a; }
    long[] larr(int n) throws Exception { long[] a = new long[n];for (int i = 0; i < n; i++) a[i] = sc.nextLong();return a; }
    TreeMap<Long, Integer> counts(long[] arr) { TreeMap<Long, Integer> counts = new TreeMap<>(); for (long a : arr) { if (!counts.containsKey(a)) counts.put(a, 0); counts.put(a, counts.get(a) + 1);} return counts; }
    String reverse(String s, int i, int j) /*[i, j] closed*/ { return (i > j) ? reverse(s, j, i) : s.substring(0, i) + (new StringBuilder(s.substring(i, j + 1))).reverse() + ((j + 1 <= s.length() - 1) ? s.substring(j + 1) : "");}
    Reader sc = new Reader(); public static void main(String[] args) throws Exception{new Main();}
    static class Reader{
        final private int BUFFER_SIZE = 1 << 22;
        private DataInputStream din;private byte[] buffer;
        private int bufferPointer, bytesRead;public Reader(){
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];bufferPointer = bytesRead = 0;}
            public Reader(String file_name) throws IOException
            {din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];bufferPointer = bytesRead = 0;}
            public String readLine() throws IOException{byte[] buf = new byte[1<<18];
            int cnt = 0, c;while ((c = read()) != -1)
            {if (c == '\n')break;buf[cnt++] = (byte) c;}
            return new String(buf, 0, cnt);}
            public int nextInt() throws IOException{    int ret = 0;    byte c = read();    while (c <= ' ')        c = read();    boolean neg = (c == '-');    if (neg)        c = read();    do    {        ret = ret * 10 + c - '0';    }  while ((c = read()) >= '0' && c <= '9');    if (neg)        return -ret;    return ret;}public long nextLong() throws IOException{    long ret = 0;    byte c = read();    while (c <= ' ')        c = read();    boolean neg = (c == '-');    if (neg)        c = read();    do {        ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)        return -ret;    return ret;}public double nextDouble() throws IOException{    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')        c = read();    boolean neg = (c == '-');    if (neg)        c = read();    do {        ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.')    {        while ((c = read()) >= '0' && c <= '9')        {            ret += (c - '0') / (div *= 10);        }    }    if (neg)        return -ret;    return ret;}private void fillBuffer() throws IOException{    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)        buffer[0] = -1;}private byte read() throws IOException{    if (bufferPointer == bytesRead)        fillBuffer();    return buffer[bufferPointer++];}public void close() throws IOException{    if (din == null)        return;    din.close();}} Main() throws Exception{if (multiple){ int q = sc.nextInt();for (int i = 0; i < q; i++) solve();} else solve(); out.close();} PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class D {
	static int N, M;
	static final long p = 998244353;
	static long factor[];

	static long Uclede(long a, long b) {
		long[] s = new long[2];
		long[] t = new long[2];
		s[0] = 1;
		t[0] = 0;
		s[1] = 0;
		t[1] = 1;
		while (a % b != 0) {
			long ss = (s[0] - (a / b) * s[1]) ;
			long tt = (t[0] - (a / b) * t[1]) ;

			s[0] = s[1];
			t[0] = t[1];
			s[1] = ss;
			t[1] = tt;
			long tmp = a % b;
			a = b;
			b = tmp;
		}
		return t[1] < 0 ? t[1] + p : t[1];

	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		N = Integer.parseInt(st.nextToken());
		M = Integer.parseInt(st.nextToken());

		factor = new long[M + 1];
		factor[1] = 1;

		for (int m = 2; m <= M; m++) {
			factor[m] = (m * factor[m - 1]) % p;
		}
		long Answer = 1;
		Answer = (Answer * factor[M]) %p;
		Answer = (Answer * Uclede(p,(factor[M-N+1] * factor[N-1])%p)) %p;
		Answer = (Answer * (N-2)) %p;
		long lpow = 1L;
		for(int i=0;i<N-3;i++) {
			lpow =(lpow *2)%p;
		}
		Answer = (Answer * lpow) %p;
		System.out.println(Answer);
	}
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	static ArrayList<Integer> adj[];
	static PrintWriter out = new PrintWriter(System.out);
	public static long mod;

	static int notmemo[][][];
	static int k;
	static long a[];
	static int b[];
	static int m;
	static char c[];

	static int trace[];
	static int h;
	static int x;
	static int ans1;
	static int ans2;
    static char t[];
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		mod=  998244353;
		long n=sc.nextInt();
		long m=sc.nextInt();
		fac= new long[(int) (m+1)];
        fac[0]=fac[1]=1;
        for (int i =2;i<=m;i++){
            fac[i]=(i*fac[i-1])%mod;
        }

        long inv = fac[(int) m];
        inv*=modPow(fac[(int) (n-1)],mod-2,mod);
        inv%=mod;
        inv*=modPow(fac[(int) (m-n+1)],mod-2,mod);
        inv%=mod;
        long pow2=modPow(2, n-3,mod);
        inv*=pow2;
        inv%=mod;
        inv=inv*(n-2);

        inv%=mod;
        System.out.println(inv);
	}

	static long fac[];
	static long modPow1(long a, long e, long mod)	// O(log e)
	{
		a %= mod;
		long res = 1;
		while(e > 0)
		{
			if((e & 1) == 1)
				res = (res * a) % mod;
			a = (a * a) % mod;
			e >>= 1;
		}
		return res;
	}

	public static long inv(long ans)
	{
	    return modPow1(2,mod-2, mod);
	}
	static long fact(long n) {
		long mm=1;

		for (int i = 0; i <n-1; i++) {
			mm*=(n-i);
		mm%=998244353;
		}
		return mm;
	}

	static long nCr1(int n, int k) {
		if (n < k)
			return 0;
		if (k == 0 || k == n)
			return 1;
		if (comb[n][k] != -1)
			return comb[n][k];
		if (n - k < k)
			return comb[n][k] = nCr1(n, n - k);
		return comb[n][k] = ((nCr1(n - 1, k - 1) % mod) + (nCr1(n - 1, k) % mod)) % mod;
	}
    public static int dp(int i, int j, int idx) {
    if(i==c.length) {
    	if(idx==t.length)
return 0;
    	return (int) -1e9;
    }
    if(notmemo[i][j][idx]!=-1) {
    	return notmemo[i][j][idx];
    }
    int take=(int) -1e9;
    int take1=(int) -1e9;
    if(j<t.length&&c[i]==t[j]) {
    	take=1+dp(i+1,j+1,idx);
    }
    if(idx<t.length&&c[i]==t[idx])
    {
    take1=dp(i+1,j,idx+1);
    }
    int leave=dp(i+1,j,idx);
    return notmemo[i][j][idx]=Math.max(take1, Math.max(leave,take));

    }

	static class book implements Comparable<book> {
		int idx;
		long score;

		public book(int i, long s) {
			idx = i;
			score = s;
		}

		public int compareTo(book o) {
			return (int) (o.score - score);
		}
	}

	static class library implements Comparable<library> {
		int numofbooks;
		int signup;
		int shiprate;
		int idx;

		public library(int a, int b, int c, int idx) {
			numofbooks = a;
			signup = b;
			shiprate = c;
			this.idx = idx;
		}

		@Override
		public int compareTo(library o) {
		if(signup==o.signup) {
			  return o.numofbooks-numofbooks;
		}
		return signup - o.signup;

		}
	}

	static boolean isPal(String s) {
		int j = s.length() - 1;
		c = s.toCharArray();
		Arrays.sort(c);
		for (int i = 0; i < c.length; i++) {

		}
		return true;
	}

	static String s;

	static boolean isOn(int S, int j) {
		return (S & 1 << j) != 0;
	}

	static int y, d;

	static void extendedEuclid(int a, int b) {
		if (b == 0) {
			x = 1;
			y = 0;
			d = a;
			return;
		}
		extendedEuclid(b, a % b);
		int x1 = y;
		int y1 = x - a / b * y;
		x = x1;
		y = y1;
	}

	static boolean f = true;

	static class SegmentTree { // 1-based DS, OOP

		int N; // the number of elements in the array as a power of 2 (i.e. after padding)
		int[] array, sTree, lazy;

		SegmentTree(int[] in) {
			array = in;
			N = in.length - 1;
			sTree = new int[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero
			lazy = new int[N << 1];
			build(1, 1, N);
		}

		void build(int node, int b, int e) // O(n)
		{
			if (b == e)
				sTree[node] = array[b];
			else {
				int mid = b + e >> 1;
				build(node << 1, b, mid);
				build(node << 1 | 1, mid + 1, e);
				sTree[node] = sTree[node << 1] + sTree[node << 1 | 1];
			}
		}

		void update_point(int index, int val) // O(log n)
		{
			index += N - 1;
			sTree[index] += val;
			while (index > 1) {
				index >>= 1;
				sTree[index] = Math.max(sTree[index << 1], sTree[index << 1 | 1]);
			}
		}

		void update_range(int i, int j, int val) // O(log n)
		{
			update_range(1, 1, N, i, j, val);
		}

		void update_range(int node, int b, int e, int i, int j, int val) {
			if (i > e || j < b)
				return;
			if (b >= i && e <= j) {
				sTree[node] += (e - b + 1) * val;
				lazy[node] += val;
			} else {
				int mid = b + e >> 1;
				propagate(node, b, mid, e);
				update_range(node << 1, b, mid, i, j, val);
				update_range(node << 1 | 1, mid + 1, e, i, j, val);
				sTree[node] = sTree[node << 1] + sTree[node << 1 | 1];
			}

		}

		void propagate(int node, int b, int mid, int e) {
			lazy[node << 1] += lazy[node];
			lazy[node << 1 | 1] += lazy[node];
			sTree[node << 1] += (mid - b + 1) * lazy[node];
			sTree[node << 1 | 1] += (e - mid) * lazy[node];
			lazy[node] = 0;
		}

		int query(int i, int j) {
			return query(1, 1, N, i, j);
		}

		int query(int node, int b, int e, int i, int j) // O(log n)
		{
			if (i > e || j < b)
				return 0;
			if (b >= i && e <= j)
				return sTree[node];
			int mid = b + e >> 1;
			// propagate(node, b, mid, e);
			int q1 = query(node << 1, b, mid, i, j);
			int q2 = query(node << 1 | 1, mid + 1, e, i, j);
			return Math.max(q1, q2);

		}
	}

	static int memo[][];

	static class UnionFind {
		int[] p, rank, setSize;
		int numSets;
		int max[];

		public UnionFind(int N) {
			max = new int[N];
			p = new int[numSets = N];
			rank = new int[N];
			setSize = new int[N];
			for (int i = 0; i < N; i++) {
				p[i] = i;
				setSize[i] = 1;
				max[i] = i;
			}
		}

		public int findSet(int i) {
			return p[i] == i ? i : (p[i] = findSet(p[i]));
		}

		public boolean isSameSet(int i, int j) {
			return findSet(i) == findSet(j);
		}

		public void unionSet(int i, int j) {
			if (isSameSet(i, j))
				return;
			numSets--;
			int x = findSet(i), y = findSet(j);
			if (rank[x] > rank[y]) {
				p[y] = x;
				setSize[x] += setSize[y];
				max[x] = Math.max(max[x], max[y]);

			} else {
				p[x] = y;
				setSize[y] += setSize[x];
				if (rank[x] == rank[y])
					rank[y]++;
				max[y] = Math.max(max[x], max[y]);

			}
		}

		private int getmax(int j) {
			return max[findSet(j)];
		}

		public int numDisjointSets() {
			return numSets;
		}

		public int sizeOfSet(int i) {
			return setSize[findSet(i)];
		}
	}

	/**
	 * private static void trace(int i, int time) { if(i==n) return;
	 *
	 *
	 * long ans=dp(i,time);
	 * if(time+a[i].t<a[i].burn&&(ans==dp(i+1,time+a[i].t)+a[i].cost)) {
	 *
	 * trace(i+1, time+a[i].t);
	 *
	 * l1.add(a[i].idx); return; } trace(i+1,time);
	 *
	 * }
	 **/

	static class incpair implements Comparable<incpair> {
		int a;
		long b;
		int idx;

		incpair(int a, long dirg, int i) {
			this.a = a;
			b = dirg;
			idx = i;
		}

		public int compareTo(incpair e) {
			return (int) (b - e.b);
		}
	}

	static class decpair implements Comparable<decpair> {
		int a;
		long b;
		int idx;

		decpair(int a, long dirg, int i) {
			this.a = a;
			b = dirg;
			idx = i;
		}

		public int compareTo(decpair e) {
			return (int) (e.b - b);
		}
	}

	static long allpowers[];

	static class Quad implements Comparable<Quad> {
		int u;
		int v;
		char state;
		int turns;

		public Quad(int i, int j, char c, int k) {
			u = i;
			v = j;
			state = c;
			turns = k;
		}

		public int compareTo(Quad e) {
			return (int) (turns - e.turns);
		}

	}

	static long dirg[][];
	static Edge[] driver;

	static int n;

	static class Edge implements Comparable<Edge> {
		int node;
		long cost;

		Edge(int a, long dirg) {
			node = a;
			cost = dirg;
		}

		public int compareTo(Edge e) {
			return (int) (cost - e.cost);
		}
	}

	static long manhatandistance(long x, long x2, long y, long y2) {
		return Math.abs(x - x2) + Math.abs(y - y2);
	}

	static long fib[];

	static long fib(int n) {
		if (n == 1 || n == 0) {
			return 1;
		}
		if (fib[n] != -1) {
			return fib[n];
		} else
			return fib[n] = ((fib(n - 2) % mod + fib(n - 1) % mod) % mod);
	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int x, int y) {
			a = x;
			b = y;
		}

		@Override
		public int compareTo(Pair c) {
			return b-c.b;
		}

	}

	static long[][] comb;

	static class Triple implements Comparable<Triple> {

		int l;
		int r;
		long cost;
		int idx;

		public Triple(int a, int b, long l1, int l2) {
			l = a;
			r = b;
			cost = l1;
			idx = l2;
		}

		public int compareTo(Triple x) {
			if (l != x.l || idx == x.idx)
				return l - x.l;
			return -idx;
		}

	}

	static TreeSet<Long> primeFactors(long N) // O(sqrt(N) / ln sqrt(N))
	{
		TreeSet<Long> factors = new TreeSet<Long>(); // take abs(N) in case of -ve integers
		int idx = 0, p = primes.get(idx);

		while (p * p <= N) {
			while (N % p == 0) {
				factors.add((long) p);
				N /= p;
			}
			if (primes.size() > idx + 1)
				p = primes.get(++idx);
			else
				break;
		}

		if (N != 1) // last prime factor may be > sqrt(N)
			factors.add(N); // for integers whose largest prime factor has a power of 1
		return factors;
	}

	static boolean visited[];

	/**
	 * static int bfs(int s) { Queue<Integer> q = new LinkedList<Integer>();
	 * q.add(s); int count=0; int maxcost=0; int dist[]=new int[n]; dist[s]=0;
	 * while(!q.isEmpty()) {
	 *
	 * int u = q.remove(); if(dist[u]==k) { break; } for(Pair v: adj[u]) {
	 * maxcost=Math.max(maxcost, v.cost);
	 *
	 *
	 *
	 * if(!visited[v.v]) {
	 *
	 * visited[v.v]=true; q.add(v.v); dist[v.v]=dist[u]+1; maxcost=Math.max(maxcost,
	 * v.cost); } }
	 *
	 * } return maxcost; }
	 **/
	public static boolean FindAllElements(int n, int k) {
		int sum = k;
		int[] A = new int[k];
		Arrays.fill(A, 0, k, 1);

		for (int i = k - 1; i >= 0; --i) {

			while (sum + A[i] <= n) {

				sum += A[i];
				A[i] *= 2;
			}
		}
		if (sum == n) {
			return true;
		} else
			return false;
	}

	static boolean vis2[][];

	static boolean f2 = false;

	static long[][] matMul(long[][] a2, long[][] b, int p, int q, int r) // C(p x r) = A(p x q) x (q x r) -- O(p x q x
																			// r)
	{
		long[][] C = new long[p][r];
		for (int i = 0; i < p; ++i) {
			for (int j = 0; j < r; ++j) {
				for (int k = 0; k < q; ++k) {
					C[i][j] = (C[i][j] + (a2[i][k] % mod * b[k][j] % mod)) % mod;
					C[i][j] %= mod;
				}

			}
		}
		return C;
	}

	static ArrayList<Pair> a1[];
	static int memo1[];

	static boolean vis[];
	static TreeSet<Integer> set = new TreeSet<Integer>();

	static long modPow(long ways, long count, long mod) // O(log e)
	{
		ways %= mod;
		long res = 1;
		while (count > 0) {
			if ((count & 1) == 1)
				res = (res * ways) % mod;
			ways = (ways * ways) % mod;
			count >>= 1;
		}
		return res % mod;
	}

	static long gcd(long ans, long b) {
		if (b == 0) {
			return ans;
		}
		return gcd(b, ans % b);
	}

	static int[] isComposite;
	static int[] valid;

	static ArrayList<Integer> primes;
	static ArrayList<Integer> l;

	static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();
		l = new ArrayList<>();
		valid = new int[N + 1];
		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				l.add(i);
				valid[i] = 1;

				for (int j = i * 2; j <= N; j += i) { // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
					isComposite[j] = 1;

				}
			}

		for (int i = 0; i < primes.size(); i++) {
			for (int j : primes) {
				if (primes.get(i) * j > N) {
					break;
				}
				valid[primes.get(i) * j] = 1;
			}
		}
	}

	public static long[] schuffle(long[] sad) {
		for (int i = 0; i < sad.length; i++) {
			int x = (int) (Math.random() * sad.length);
			long temp = sad[x];
			sad[x] = sad[i];
			sad[i] = temp;
		}
		return sad;
	}

	static int V;
	static long INF = (long) 1E16;

	static class Edge2 {
		int node;
		long cost;
		long next;

		Edge2(int a, int c, Long long1) {
			node = a;
			cost = long1;
			next = c;
		}

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}

		public int[] nxtArr(int n) throws IOException {
			int[] ans = new int[n];
			for (int i = 0; i < n; i++)
				ans[i] = nextInt();
			return ans;
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        final long MODULO = 998244353L;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.nextLong();
            long m = in.nextLong();

            long factm = 1;
            for (int i = 2; i <= m; i++) {
                factm = (factm * i) % MODULO;
            }
            long fact1 = 1;
            for (int i = 2; i <= m - (n - 1); i++) {
                fact1 = (fact1 * i) % MODULO;
            }
            long fact2 = 1;
            for (int i = 2; i <= n - 1; i++) {
                fact2 = (fact2 * i) % MODULO;
            }
            long pow2 = 1;
            for (int i = 1; i <= n - 3; i++) {
                pow2 = (pow2 * 2) % MODULO;
            }

            long t = (fact1 * fact2) % MODULO;
            long inv = Algorithms.inverseByModulo(t, MODULO);
            long ans = (factm * inv) % MODULO;
            ans = (ans * (n - 2)) % MODULO;
            ans = (ans * pow2) % MODULO;
            out.println(ans);
        }

    }

    static class Algorithms {
        public static long inverseByModulo(long a, long n) {
            long t = 0, newt = 1, r = n, newr = a;
            while (newr != 0) {
                long q = r / newr;

                long temp = newt;
                newt = t - q * newt;
                t = temp;

                temp = newr;
                newr = r - q * newr;
                r = temp;
            }

            if (r > 1)
                return 0;
            if (t < 0)
                t += n;
            return t;
        }

    }

    static class InputReader {
        final InputStream is;
        final byte[] buffer = new byte[1024];
        int curCharIdx;
        int nChars;

        public InputReader(InputStream is) {
            this.is = is;
        }

        public int read() {
            if (curCharIdx >= nChars) {
                try {
                    curCharIdx = 0;
                    nChars = is.read(buffer);
                    if (nChars == -1)
                        return -1;
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return buffer[curCharIdx++];
        }

        public long nextLong() {
            int sign = 1;
            int c = skipDelims();
            if (c == '-') {
                sign = -1;
                c = read();
                if (isDelim(c))
                    throw new RuntimeException("Incorrect format");
            }
            long val = 0;
            while (c != -1 && !isDelim(c)) {
                if (!isDigit(c))
                    throw new RuntimeException("Incorrect format");
                val = 10L * val + (c - '0');
                c = read();
            }
            return val * sign;
        }

        private final int skipDelims() {
            int c = read();
            while (isDelim(c)) {
                c = read();
            }
            return c;
        }

        private static boolean isDelim(final int c) {
            return c == ' ' ||
                    c == '\n' ||
                    c == '\t' ||
                    c == '\r' ||
                    c == '\f';
        }

        private static boolean isDigit(final int c) {
            return '0' <= c && c <= '9';
        }

    }
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;

public final class Second {
    public static final long x = 998244353;

    public static long binPow(long a, long n) {
        long z = 1;
        while(n != 0) {
            if((n & 1) == 1)
                z = (z * a) % x;
            a = (a * a) % x;
            n >>= 1;
        }
        return z;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        if(n <= 2) {
            System.out.println(0);
            return;
        }
        ArrayList<Long> fact = new ArrayList<>(), invFact = new ArrayList<>();
        fact.add(1L);
        invFact.add(1L);
        for(int i = 1; i <= m; i++) {
            fact.add((i * fact.get(i - 1)) % x);
            invFact.add(binPow(fact.get(i), x - 2));
        }
        long ans1 = (fact.get(m) * binPow(2, n - 3)) % x ;
        ans1 = (ans1 * (n - 2)) % x;
        long ans2 =(invFact.get(m - n + 1) * invFact.get(n - 1)) % x;
        System.out.println((ans1 * ans2) % x);
    }
}

import java.io.*;
import java.util.*;

public class codeforces {
	public static PrintWriter out;
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
	// The next two void functions are shuffle functions on an array.
	// This way, quick sort encounters the worst case scenario with low probability.
	// A reason for doing this is if we don't a primitive data array to an object array.
	// For safety reasons, it would be preferable to use object arrays unless doing so expends a lot of time.
	public static void shuffleLongArray(long[] arr) {
		int n = arr.length;
		Random rnd = new Random();
        for (int i=0; i < n; ++i) {
        	long tmp = arr[i];
        	int randomPos = i + rnd.nextInt(n-i);
        	arr[i] = arr[randomPos];
        	arr[randomPos] = tmp;
        }
	}
	public static void shuffleIntArray(int[] arr) {
		int n = arr.length;
		Random rnd = new Random();
        for (int i=0; i < n; ++i) {
        	int tmp = arr[i];
        	int randomPos = i + rnd.nextInt(n-i);
        	arr[i] = arr[randomPos];
        	arr[randomPos] = tmp;
        }
	}
	public static long inf = 998244353L;
	public static void main (String[] args) throws IOException {
    	MyScanner sc = new MyScanner();
    	out = new PrintWriter(new BufferedOutputStream(System.out));
    	// Write your solution here.
    	long n = sc.nextLong(); long m = sc.nextLong();
    	if (n<=2L) {
    		out.println(0L); out.close(); return;
    	}
    	long w = n;
    	--n;
    	if (m-n < n) n = m-n;
    	long ans = 1L;
    	for (long i=0; i < n; ++i) {
    		ans = (ans*(m-i)) % inf;
    	}
    	for (long i=1; i <= n; ++i) {
    		ans = ans*(exp(i, inf-2)) % inf;
    	}
    	ans = (ans*(w-2L)) % inf;
    	for (long i=0; i < w-3L; ++i) {
    		ans = (ans*2L) % inf;
    	}
    	out.println(ans);
    	out.close();
	}
	public static long exp(long z, long e) {
		if (e == 0L) return 1L;
		else if (e == 1L) return z;
		long y = z;
		String g = Long.toBinaryString(e);
		for (int i=1; i < g.length(); ++i) {
			y = (y*y) % inf;
			if (g.charAt(i)=='1') y = (y*z) % inf;
		}
		return y;
	}
	public static int gcd(int a, int b) {
		if (a > b) {
			int tmp = a; a = b; b = tmp;
		}
		if (b % a == 0) return a;
		else return gcd(b % a, a);
	}
}

import java.util.*;

import javax.sound.sampled.ReverbType;

import java.io.*;

public class B {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		long sum = power(2, n - 3, 998244353);
		sum %= 998244353;
		long ans = nCrModPFermat(m, n - 1, 998244353)*(n-2)%998244353;
//		System.out.println(ans * sum);
		ans = (ans * sum) % 998244353;
		pw.println(ans);
		pw.flush();

	}

	static long nCr4(int N, int K) // O(K)
	{
		if (K > N)
			return 0;
		long res = 1;
		for (int i = 1; i <= K; ++i) {
			res = res * (N - K + i) / i;
			System.out.println(res);
//			res %= 998244353;
		}
		return res;
	}

	static long power(long x, long y, int p) {

		// Initialize result
		long res = 1;

		// Update x if it is more than or
		// equal to p
		x = x % p;

		while (y > 0) {

			// If y is odd, multiply x
			// with result
			if (y % 2 == 1)
				res = (res * x) % p;

			// y must be even now
			y = y >> 1; // y = y/2
			x = (x * x) % p;
		}

		return res;
	}

	// Returns n^(-1) mod p
	static long modInverse(long n, int p) {
		return power(n, p - 2, p);
	}

	// Returns nCr % p using Fermat's
	// little theorem.
	static long nCrModPFermat(int n, int r, int p) {

		// Base case
		if (r == 0)
			return 1;

		// Fill factorial array so that we
		// can find all factorial of r, n
		// and n-r
		long[] fac = new long[n + 1];
		fac[0] = 1;

		for (int i = 1; i <= n; i++)
			fac[i] = (fac[i - 1] * i) % p;

		return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
	}

	static boolean[] vis;

	static boolean check(long x, ArrayList<Long> arr) {
		for (int i = vis.length - 1; i >= 0 && x != 0; i--) {
			if (!vis[i] && arr.get(i) <= x) {
				x -= arr.get(i);
				vis[i] = true;
			}
		}
//		System.out.println(x);
		return x == 0;
	}

	static long pow(long a, long e) // O(log e)
	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res *= a;
			a *= a;
			e >>= 1;
		}
		return res;
	}

	static String rev(String s) {
		StringBuilder sb = new StringBuilder();
		for (int i = s.length() - 1; i >= 0; i--) {
			sb.append(s.charAt(i));
		}
		return sb.toString();
	}

	static class triple implements Comparable<triple> {
		int x;
		int y;
		int z;

		public triple(int a, int b, int c) {
			x = a;
			y = b;
			z = c;
		}

		@Override
		public int compareTo(triple o) {
			// TODO Auto-generated method stub
			return x - o.x;
		}
	}

	static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	static class SegmentTree { // 1-based DS, OOP

		int N; // the number of elements in the array as a power of 2 (i.e. after padding)
		long[] array, sTree, lazy;

		SegmentTree(long[] in) {
			array = in;
			N = in.length - 1;
			sTree = new long[N << 1];
			Arrays.fill(sTree, 1);// no. of nodes = 2*N - 1, we add one to cross out index zero
			lazy = new long[N << 1];
			build(1, 1, N);
		}

		void build(int node, int b, int e) // O(n)
		{
			if (b == e)
				sTree[node] = array[b];
			else {
				int mid = b + e >> 1;
				build(node << 1, b, mid);
				build(node << 1 | 1, mid + 1, e);
				sTree[node] = lcm(sTree[node << 1], sTree[node << 1 | 1]);
			}
		}

		void update_point(int index, int val) // O(log n)
		{
			index += N - 1;
			sTree[index] += val;
			while (index > 1) {
				index >>= 1;
				sTree[index] = sTree[index << 1] + sTree[index << 1 | 1];
			}
		}

		void update_range(int i, int j, int val) // O(log n)
		{
			update_range(1, 1, N, i, j, val);
		}

		void update_range(int node, int b, int e, int i, int j, int val) {
			if (i > e || j < b)
				return;
			if (b >= i && e <= j) {
				sTree[node] += (e - b + 1) * val;
				lazy[node] += val;
			} else {
				int mid = b + e >> 1;
				propagate(node, b, mid, e);
				update_range(node << 1, b, mid, i, j, val);
				update_range(node << 1 | 1, mid + 1, e, i, j, val);
				sTree[node] = sTree[node << 1] + sTree[node << 1 | 1];
			}

		}

		void propagate(int node, int b, int mid, int e) {
			lazy[node << 1] += lazy[node];
			lazy[node << 1 | 1] += lazy[node];
			sTree[node << 1] += (mid - b + 1) * lazy[node];
			sTree[node << 1 | 1] += (e - mid) * lazy[node];
			lazy[node] = 0;
		}

		long query(int i, int j) {
			return query(1, 1, N, i, j);
		}

		long query(int node, int b, int e, int i, int j) // O(log n)
		{
			if (i > e || j < b)
				return 1;
			if (b >= i && e <= j)
				return sTree[node];
			int mid = b + e >> 1;
			long q1 = query(node << 1, b, mid, i, j);
			long q2 = query(node << 1 | 1, mid + 1, e, i, j);
			return lcm(q1, q2);

		}

	}

	static int[][] z;
	static int[] memo;

	static int dp(int s) {
		if (s == z.length)
			return 0;
		if (memo[s] != -1)
			return memo[s];
		int max = 0;
		for (int i = s; i < z.length; i++) {
			if (z[s][i] == 1) {
				if (i == z.length - 1)
					max = Math.max(max, 1 + dp(i + 1));
				else if (z[i + 1][z.length - 1] == 1)
					max = Math.max(max, 1 + dp(i + 1));
			}
		}
		return memo[s] = max;
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int u) {
			x = d;
			y = u;
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			return o.x - x;
		}

	}

	static int[] nxtarr(StringTokenizer st) {
		int[] a = new int[st.countTokens()];
		for (int i = 0; i < a.length; i++) {
			a[i] = Integer.parseInt(st.nextToken());
		}
		return a;
	}

}

import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class test2 {
	static long A = 998244353l;
	static long binomialCoeff(int n, int k)
	{
	    BigInteger res = new BigInteger("1");
	    // Since C(n, k) = C(n, n-k)
	    if ( k > n - k )
	        k = n - k;

	    // Calculate value of
	    // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
	    for (int i = 0; i < k; ++i)
	    {
	        res = res.multiply(new BigInteger(Integer.toString((n - i))));
	        res = res.mod(new BigInteger(Long.toString(A)));
	        res = res.multiply(new BigInteger(Integer.toString(i + 1)).modInverse(new BigInteger(Long.toString(A))) );
	    }
	    res = res.mod(new BigInteger(Long.toString(A)));
	    return res.longValue()%A;
	}
	public static long C(int m,int k) {
		long[][] dp = new long[2][k+1];
			dp[0][0] = 1;
		for(int i=1;i<=m;i++) {
			for(int j=1;j<=k;j++) {
				dp[1][j] = dp[0][j] + dp[0][j-1];
				dp[1][j]%=A;
			}
			for(int j=1;j<=k;j++) {
				dp[0][j] = dp[1][j];
			}
		}

		return dp[0][k];
	}
    static long power(long x, long y, long p)
    {
        // Initialize result
        long res = 1;

        // Update x if it is more
        // than or equal to p
        x = x % p;

        while (y > 0)
        {
            // If y is odd, multiply x
            // with result
            if((y & 1)==1)
                res = (res * x) % p;

            // y must be even now
            // y = y / 2
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		int m = sc.nextInt();
		//System.out.println(C(3,5));
		long res = (n-2)*binomialCoeff(m, n-1);
		res%=A;
		res*= power(2, n-3, A);
		res%=A;
		pw.println(res);
		pw.flush();
		pw.close();
	}
}
class Pair {
	int a,b;
	public Pair(int a,int b) {
		this.a = a;
		this.b = b;
	}
}

// package EducationalRound83;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemE {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String line[]=br.readLine().split(" ");
        int n=Integer.parseInt(line[0]);
        int m=Integer.parseInt(line[1]);
        long fact[]=new long[m+1];
        fact[0]=1;
        long mod=998244353;
//        long denf[]=new long[m+1];
//        denf[0]=1;
        for(int i=1;i<=m;i++){
//            System.out.println(i);
            fact[i]=(fact[i-1]*i)%mod;
//            denf[i]=modexp(fact[i],mod-2,mod);
        }
        long ans=modexp(2l,n-3,mod);
        ans=(ans*(n-2))%mod;
        long num=fact[m];
        long den=(modexp(fact[n-1],mod-2,mod)*modexp(fact[m-n+1],mod-2,mod))%mod;
        num=(num*den)%mod;
        ans=(ans*num)%mod;
        System.out.println(ans);
    }
    public static long modexp(long a,long power,long mod){
        if(power==0){
            return 1;
        }
        if(power==1){
            return a;
        }
        long small=modexp(a,power/2,mod);
        long ans=(small%mod*small%mod)%mod;
        if(power%2!=0){
            ans=(ans%mod*a%mod)%mod;
        }
        return ans;
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author maheshwari29
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        CAddingPowers solver = new CAddingPowers();
        solver.solve(1, in, out);
        out.close();
    }

    static class CAddingPowers {
        static long mod = 998244353;

        static long exponent(long a, long n) {
            long ans = 1;
            while (n != 0) {
                if (n % 2 == 1) ans = (ans * a) % mod;
                a = (a * a) % mod;
                n = n >> 1;
            }
            return ans;
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int i, j;
            int n = in.ni();
            int m = in.ni();
            long temp[] = new long[200001];
            if (n == 2) {
                out.println(m);
                return;
            }
            temp[1] = 1;
            temp[0] = 1;
            for (i = 1; i <= 200000; i++)
                temp[i] = (temp[i - 1] * i) % mod;
            long power = exponent(2, n - 3);
            long num = temp[m];
            long den = (temp[n - 1] * temp[m - n + 1]) % mod;
            long den2 = exponent(den, mod - 2);
            long ans = (den2 * num) % mod;
            long ans1 = (ans * (n - 2)) % mod;
            long ans3 = (power * ans1) % mod;
            out.println(ans3);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

 public class Main
{
	public static void main(String[] args)
	{
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);

 		int n =fr.nextInt() ,m =fr.nextInt() ,i ;	long fct[] =new long[m+1] ,md =998244353l ,j ,nm ,den ,l ,ans =0l ;
 		fct[0] =1l ;	for (j =i =1 ; i<=m ; ++i, ++j)	fct[i] =(fct[i-1] * j)%md ;
 		if (n==2l)	op.println("0") ;
 		else {
	 		for (i =n-1 ; i<=m ; ++i) {
	 			nm =fct[i-1] ;	den =(fct[n-2] * fct[i-n+1])%md ;	den =pow (den , md-2l , md) ;
	 			nm =(nm * den)%md ;	ans =(ans+nm)%md ;
	 		}
	 		ans =(ans * (n-2l))%md ;	l =0l ;
	 		for (i =2 ; i<n ; ++i) {
	 			den =fct[i-2] ;	nm =fct[n-3] ;	j =fct[n-i-1] ;
	 			den =(den * j)%md ;	den =pow (den , md-2l , md) ;	nm =(nm * den)%md ;
	 			l =(l + nm)%md ;
	 		}
	 		ans =(ans * l)%md ;
	 	}
		op.println(ans) ;	op.flush();	op.close();
	}
	static long pow (long b , long e , long md) {
		if (e==0l)	return 1l;
		if (e==1l)	return b;
		long dm =pow(b , e/2l , md) ;	dm =(dm*dm)%md ;
		if ((e&1l)==1l)	dm =(dm * b)%md ;
		return dm ;
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements()))
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}

			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next()) ;
		}
	}
}

import java.io.*;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.BinaryOperator;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    private final static long mod = 998244353;

    private final static int MAXN = 1000001;

    private static long power(long x, long y, long m) {
        long temp;
        if (y == 0)
            return 1;
        temp = power(x, y / 2, m);
        temp = (temp * temp) % m;
        if (y % 2 == 0)
            return temp;
        else
            return ((x % m) * temp) % m;
    }

    private static long power(long x, long y) {
        return power(x, y, mod);
    }

    private static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    static int nextPowerOf2(int a) {
        return 1 << nextLog2(a);
    }

    static int nextLog2(int a) {
        return (a == 0 ? 0 : 32 - Integer.numberOfLeadingZeros(a - 1));
    }

    private static long modInverse(long a, long m) {
        long m0 = m;
        long y = 0, x = 1;
        if (m == 1)
            return 0;
        while (a > 1) {
            long q = a / m;
            long t = m;
            m = a % m;
            a = t;
            t = y;
            y = x - q * y;
            x = t;
        }
        if (x < 0)
            x += m0;
        return x;
    }

    private static int[] getLogArr(int n) {
        int arr[] = new int[n + 1];
        for (int i = 1; i < n + 1; i++) {
            arr[i] = (int) (Math.log(i) / Math.log(2) + 1e-10);
        }
        return arr;
    }

    private static int log[] = getLogArr(MAXN);

    private static int getLRSpt(int st[][], int L, int R, BinaryOperator<Integer> binaryOperator) {
        int j = log[R - L + 1];
        return binaryOperator.apply(st[L][j], st[R - (1 << j) + 1][j]);
    }

    private static int[][] getSparseTable(int array[], BinaryOperator<Integer> binaryOperator) {
        int k = log[array.length+1] + 1;
        int st[][] = new int[array.length+1][k + 1];

        for (int i = 0; i < array.length; i++)
            st[i][0] = array[i];

        for (int j = 1; j <= k; j++) {
            for (int i = 0; i + (1 << j) <= array.length; i++) {
                st[i][j] = binaryOperator.apply(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]);
            }
        }
        return st;
    }

    static class Subset {
        int parent;
        int rank;

        @Override
        public String toString() {
            return "" + parent;
        }
    }

    static int find(Subset[] Subsets, int i) {
        if (Subsets[i].parent != i)
            Subsets[i].parent = find(Subsets, Subsets[i].parent);
        return Subsets[i].parent;
    }

    static void union(Subset[] Subsets, int x, int y) {
        int xroot = find(Subsets, x);
        int yroot = find(Subsets, y);

        if (Subsets[xroot].rank < Subsets[yroot].rank)
            Subsets[xroot].parent = yroot;
        else if (Subsets[yroot].rank < Subsets[xroot].rank)
            Subsets[yroot].parent = xroot;
        else {
            Subsets[xroot].parent = yroot;
            Subsets[yroot].rank++;
        }
    }

    private static int maxx(Integer... a) {
        return Collections.max(Arrays.asList(a));
    }

    private static int minn(Integer... a) {
        return Collections.min(Arrays.asList(a));
    }

    private static long maxx(Long... a) {
        return Collections.max(Arrays.asList(a));
    }

    private static long minn(Long... a) {
        return Collections.min(Arrays.asList(a));
    }

    private static class Pair<T, U> implements Comparable<Pair<T, U>>{
        T a;
        U b;

        public Pair(T a, U b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Pair pair = (Pair) o;
            return a.equals(pair.a) &&
                    b.equals(pair.b);
        }

        @Override
        public int hashCode() {
            return Objects.hash(a, b);
        }

        @Override
        public String toString() {
            return "(" + a +
                    "," + b +
                    ')';
        }

        @Override
        public int compareTo(Pair<T, U> o) {
            return (int)(this.a.equals(o.a)?
                    this.b.equals(o.b)?0:((Integer)this.b-(Integer)o.b)/Math.abs((Integer)this.b-(Integer)o.b):
                    ((Integer)this.a-(Integer)o.a)/Math.abs((Integer)this.a-(Integer)o.a));
        }
    }

    private static boolean isPrimeAKS(long n) {
        if(n%mod==0||n<2) return false;
        if(n>2&&n%2==0)return false;
        return (power((mod-1),n, n)==(power(mod,n,n)-1+n)%n);
    }

    public static int upperBound(List<Integer> list, int value) {
        int low = 0;
        int high = list.size();
        while (low < high) {
            final int mid = (low + high) / 2;
            if (value >= list.get(mid)) {
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        return low;
    }

    private static int[] getLPSArray(String pattern) {
        int i,j,n=pattern.length();
        int[] lps = new int[pattern.length()];
        lps[0]=0;
        for(i=1,j=0;i<n;){
            if(pattern.charAt(i)==pattern.charAt(j)) {
                lps[i++]=++j;
            }
            else if(j>0){
                j=lps[j-1];
            }
            else {
                lps[i++]=0;
            }
        }
        return lps;
    }

    private static List<Integer> findPattern(String text, String pattern) {
        List<Integer> matchedIndexes = new ArrayList<>();
        if(pattern.length()==0) {
            return matchedIndexes;
        }
        int[] lps = getLPSArray(pattern);
        int i=0,j=0,n=text.length(),m=pattern.length();
        while(i<n) {
            if(text.charAt(i)==pattern.charAt(j)) {
                i++;
                j++;
            }
            if (j == m) {
                matchedIndexes.add(i - j);
                j = lps[j - 1];
            }
            if(i<n&&text.charAt(i)!=pattern.charAt(j)) {
                if (j > 0) {
                    j = lps[j - 1];
                } else {
                    i++;
                }
            }
        }
        return matchedIndexes;
    }

    private static Set<Long> getDivisors(long n) {
        Set<Long> divisors = new HashSet<>();
        divisors.add(1L);
        divisors.add(n);
        for (long i = 2; i <= Math.sqrt(n); i++) {
            if (n % i == 0) {
                divisors.add(i);
                divisors.add(n / i);
            }
        }
        return divisors;
    }

    private static long getLCM(long a, long b) {
        return (Math.max(a,b)/gcd(a,b))*Math.min(a,b);
    }

    static long fac[]=new long[2000005];
    static long ifac[]=new long[2000005];

    private static void preCompute(){
        fac[0]=ifac[0]=fac[1]=ifac[1]=1;
        int i;
        for(i=2;i<2000005;i++){
            fac[i]=(i*fac[i-1])%mod;
            ifac[i]=(power(i,mod-2)*ifac[i-1])%mod;
        }
    }

    private static long C(int n,int r){
        if(n<0||r<0)return 0;
        if(r>n) return 0;
        return (fac[n]*((ifac[r]*ifac[n-r])%mod))%mod;
    }

    private static void reverse(int []arr, int l,int r){

        while(l<r){
            int tmp=arr[l];
            arr[l]=arr[r];
            arr[r]=tmp;
            l++;
            r--;
        }
    }

    public static long countArrays(int n, int m) {
        long ans = (
                (
                        (
                                C(m, n-1)
                                        *
                                        (n-2)
                        )%mod
                )*power(2,n-3)
        )%mod;
        return ans;
    }

    public static void main(String[] args) throws Exception {

        long START_TIME = System.currentTimeMillis();
        try (FastReader in = new FastReader();
             FastWriter out = new FastWriter()) {

            int t, i, j, n, k, l, r,m, ti, tidx,gm,mx,mn,q,g;

            //for (t = in.nextInt(), tidx = 1; tidx <= t; tidx++)a
            {
                long w,x=0, y=0, z=0,sum=0,bhc=0,ans=0;
                //out.print(String.format("Case #%d: ", tidx));
                n=in.nextInt();
                m=in.nextInt();
                out.println(countArrays(n,m));
            }
            if(args.length>0 && "ex_time".equals(args[0])) {
                out.print("\nTime taken: ");
                out.println(System.currentTimeMillis()-START_TIME);
            }
            out.commit();
        } catch (Exception e){
            e.printStackTrace();
        }
    }

    public static class FastReader implements Closeable {
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        private StringTokenizer st;

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArr(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }
        Integer[] nextIntegerArr(int n) {
            Integer[] arr = new Integer[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        double[] nextDoubleArr(int n) {
            double[] arr = new double[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextDouble();
            }
            return arr;
        }

        long[] nextLongArr(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        String[] nextStrArr(int n) {
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = next();
            }
            return arr;
        }

        long[][] nextLongArr2(int n, int m) {
            long[][] arr = new long[n][m];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLongArr(m);
            }
            return arr;
        }

        @Override
        public void close() throws IOException {
            br.close();
        }
    }

    public static class FastWriter implements Closeable {
        BufferedWriter bw;
        StringBuilder sb = new StringBuilder();
        List<String> list = new ArrayList<>();
        Set<String> set = new HashSet<>();

        public FastWriter() {
            bw = new BufferedWriter(new OutputStreamWriter(System.out));
        }

        <T> void commit() throws IOException {
            bw.write(sb.toString());
            bw.flush();
            sb = new StringBuilder();
        }

        public <T> void print(T obj) throws IOException {
            sb.append(obj.toString());
            commit();
        }

        public void println() throws IOException {
            print("\n");
        }

        public <T> void println(T obj) throws IOException {
            print(obj.toString() + "\n");
        }

        <T> void printArrLn(T[] arr) throws IOException {
            for (int i = 0; i < arr.length - 1; i++) {
                print(arr[i] + " ");
            }
            println(arr[arr.length - 1]);
        }

        <T> void printArr2(T[][] arr) throws IOException {
            for (int j = 0; j < arr.length; j++) {
                for (int i = 0; i < arr[j].length - 1; i++) {
                    print(arr[j][i] + " ");
                }
                println(arr[j][arr.length - 1]);
            }
        }

        <T> void printColl(Collection<T> coll) throws IOException {
            for (T e : coll) {
                print(e + " ");
            }
            println();
        }

        void printCharN(char c, int n) throws IOException {
            for (int i = 0; i < n; i++) {
                print(c);
            }
        }

        void printIntArr2(int[][] arr) throws IOException {
            for (int j = 0; j < arr.length; j++) {
                for (int i = 0; i < arr[j].length - 1; i++) {
                    print(arr[j][i] + " ");
                }
                println(arr[j][arr.length - 1]);
            }
        }

        @Override
        public void close() throws IOException {
            bw.close();
        }
    }

}

import java.io.*;
import java.util.*;

public class D implements Runnable {
	boolean judge = false;
	FastReader scn;
	PrintWriter out;
	String INPUT = "";

	long[] fact = new long[200002];
	long[] ifact = new long[fact.length];
	int mod = 998244353;

	void solve() {
		int n = scn.nextInt(), m = scn.nextInt();

		if (n == 2) {
			out.println(m);
			return;
		}

		if (m < n - 1) {
			out.println(0);
			return;
		}

		fact[0] = 1;
		for (int i = 1; i < fact.length; i++) {
			fact[i] = (i * fact[i - 1]) % mod;
		}

		ifact[fact.length - 1] = pow(fact[fact.length - 1], mod - 2, mod);
		for (int i = fact.length - 2; i >= 0; i--) {
			ifact[i] = (ifact[i + 1] * (i + 1)) % mod;
		}

		long need = 0;
		for(int i = 2; i < n; i++) {
			need += ifact[i - 2] * ifact[n - i - 1] % mod;
			need %= mod;
		}

		long ans = 0;
		for(int k = 2; k <= m; k++) {
			if(k - 2 < 0 || k - n + 1 < 0 || k - n + 1 >= fact.length) {
				continue;
			}
			long X = need;

			X = X * (k - 1) % mod;
			X = ((X * fact[k - 2]) % mod * ifact[k - n + 1]) % mod;
			ans += X;
			ans %= mod;
		}
		out.println(ans);
	}

	long ncr(int n, int r) {
		if(r > n) {
			return 0;
		}
		return ((fact[n] * ifact[r]) % mod * ifact[n - r]) % mod;
	}

	long pow(long a, long x, long m) {
		long rv = 1;
		while (x != 0) {
			if ((x & 1) == 1) {
				rv = (rv * a) % m;
			}
			a = (a * a) % m;
			x = x >> 1;
		}
		return rv;
	}

	public void run() {
		long time = System.currentTimeMillis();
		boolean oj = System.getProperty("ONLINE_JUDGE") != null || judge;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

	public static void main(String[] args) {
		new Thread(null, new D(), "Main", 1 << 28).start();
	}

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		char nextChar() {
			return (char) skip();
		}

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		int[] shuffle(int[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				int c = arr[i];
				arr[i] = arr[j];
				arr[j] = c;
			}
			return arr;
		}

		long[] shuffle(long[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				long c = arr[i];
				arr[i] = arr[j];
				arr[j] = c;
			}
			return arr;
		}

		int[] uniq(int[] arr) {
			arr = scn.shuffle(arr);
			Arrays.sort(arr);
			int[] rv = new int[arr.length];
			int pos = 0;
			rv[pos++] = arr[0];
			for (int i = 1; i < arr.length; i++) {
				if (arr[i] != arr[i - 1]) {
					rv[pos++] = arr[i];
				}
			}
			return Arrays.copyOf(rv, pos);
		}

		long[] uniq(long[] arr) {
			arr = scn.shuffle(arr);
			Arrays.sort(arr);
			long[] rv = new long[arr.length];
			int pos = 0;
			rv[pos++] = arr[0];
			for (int i = 1; i < arr.length; i++) {
				if (arr[i] != arr[i - 1]) {
					rv[pos++] = arr[i];
				}
			}
			return Arrays.copyOf(rv, pos);
		}

		int[] reverse(int[] arr) {
			int l = 0, r = arr.length - 1;
			while (l < r) {
				arr[l] = arr[l] ^ arr[r];
				arr[r] = arr[l] ^ arr[r];
				arr[l] = arr[l] ^ arr[r];
				l++;
				r--;
			}
			return arr;
		}

		long[] reverse(long[] arr) {
			int l = 0, r = arr.length - 1;
			while (l < r) {
				arr[l] = arr[l] ^ arr[r];
				arr[r] = arr[l] ^ arr[r];
				arr[l] = arr[l] ^ arr[r];
				l++;
				r--;
			}
			return arr;
		}

		int[] compress(int[] arr) {
			int n = arr.length;
			int[] rv = Arrays.copyOf(arr, n);
			rv = uniq(rv);
			for (int i = 0; i < n; i++) {
				arr[i] = Arrays.binarySearch(rv, arr[i]);
			}
			return arr;
		}

		long[] compress(long[] arr) {
			int n = arr.length;
			long[] rv = Arrays.copyOf(arr, n);
			rv = uniq(rv);
			for (int i = 0; i < n; i++) {
				arr[i] = Arrays.binarySearch(rv, arr[i]);
			}
			return arr;
		}
	}
}

import java.io.*;
import java.util.*;

public class codeforces {
	public static PrintWriter out;
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
	// The next two void functions are shuffle functions on an array.
	// This way, quick sort encounters the worst case scenario with low probability.
	// A reason for doing this is if we don't a primitive data array to an object array.
	// For safety reasons, it would be preferable to use object arrays unless doing so expends a lot of time.
	public static void shuffleLongArray(long[] arr) {
		int n = arr.length;
		Random rnd = new Random();
        for (int i=0; i < n; ++i) {
        	long tmp = arr[i];
        	int randomPos = i + rnd.nextInt(n-i);
        	arr[i] = arr[randomPos];
        	arr[randomPos] = tmp;
        }
	}
	public static void shuffleIntArray(int[] arr) {
		int n = arr.length;
		Random rnd = new Random();
        for (int i=0; i < n; ++i) {
        	int tmp = arr[i];
        	int randomPos = i + rnd.nextInt(n-i);
        	arr[i] = arr[randomPos];
        	arr[randomPos] = tmp;
        }
	}
	public static long inf = 998244353L;
	public static void main (String[] args) throws IOException {
    	MyScanner sc = new MyScanner();
    	out = new PrintWriter(new BufferedOutputStream(System.out));
    	// Write your solution here.
    	long n = sc.nextLong(); long m = sc.nextLong();
    	--n;
    	if (m-n < n) n = m-n;
    	long ans = 1L;
    	for (long i=0; i < n; ++i) {
    		ans = (ans*(m-i)) % inf;
    	}
    	for (long i=1; i <= n; ++i) {
    		ans = ans*(exp(i, inf-2)) % inf;
    	}
    	++n;
    	ans = (ans*(n-2L)) % inf;
    	for (long i=0; i < n-3L; ++i) {
    		ans = (ans*2L) % inf;
    	}
    	out.println(ans);
    	out.close();
	}
	public static long exp(long z, long e) {
		if (e == 0L) return 1L;
		else if (e == 1L) return z;
		long y = z;
		String g = Long.toBinaryString(e);
		for (int i=1; i < g.length(); ++i) {
			y = (y*y) % inf;
			if (g.charAt(i)=='1') y = (y*z) % inf;
		}
		return y;
	}
	public static int gcd(int a, int b) {
		if (a > b) {
			int tmp = a; a = b; b = tmp;
		}
		if (b % a == 0) return a;
		else return gcd(b % a, a);
	}
}

import java.io.*;
import java.util.*;

public class codeforces {
	public static PrintWriter out;
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
	// The next two void functions are shuffle functions on an array.
	// This way, quick sort encounters the worst case scenario with low probability.
	// A reason for doing this is if we don't a primitive data array to an object array.
	// For safety reasons, it would be preferable to use object arrays unless doing so expends a lot of time.
	public static void shuffleLongArray(long[] arr) {
		int n = arr.length;
		Random rnd = new Random();
        for (int i=0; i < n; ++i) {
        	long tmp = arr[i];
        	int randomPos = i + rnd.nextInt(n-i);
        	arr[i] = arr[randomPos];
        	arr[randomPos] = tmp;
        }
	}
	public static void shuffleIntArray(int[] arr) {
		int n = arr.length;
		Random rnd = new Random();
        for (int i=0; i < n; ++i) {
        	int tmp = arr[i];
        	int randomPos = i + rnd.nextInt(n-i);
        	arr[i] = arr[randomPos];
        	arr[randomPos] = tmp;
        }
	}
	public static long inf = 998244353L;
	public static void main (String[] args) throws IOException {
    	MyScanner sc = new MyScanner();
    	out = new PrintWriter(new BufferedOutputStream(System.out));
    	// Write your solution here.
    	long n = sc.nextLong(); long m = sc.nextLong();
    	if (n==2L) {
    		out.println(0L); out.close(); return;
    	}
    	--n;
    	if (m-n < n) n = m-n;
    	long ans = 1L;
    	for (long i=0; i < n; ++i) {
    		ans = (ans*(m-i)) % inf;
    	}
    	for (long i=1; i <= n; ++i) {
    		ans = ans*(exp(i, inf-2)) % inf;
    	}
    	++n;
    	ans = (ans*(n-2L)) % inf;
    	for (long i=0; i < n-3L; ++i) {
    		ans = (ans*2L) % inf;
    	}
    	out.println(ans);
    	out.close();
	}
	public static long exp(long z, long e) {
		if (e == 0L) return 1L;
		else if (e == 1L) return z;
		long y = z;
		String g = Long.toBinaryString(e);
		for (int i=1; i < g.length(); ++i) {
			y = (y*y) % inf;
			if (g.charAt(i)=='1') y = (y*z) % inf;
		}
		return y;
	}
	public static int gcd(int a, int b) {
		if (a > b) {
			int tmp = a; a = b; b = tmp;
		}
		if (b % a == 0) return a;
		else return gcd(b % a, a);
	}
}

// package EducationalRound83;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemE {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String line[]=br.readLine().split(" ");
        int n=Integer.parseInt(line[0]);
        int m=Integer.parseInt(line[1]);
        long fact[]=new long[m+1];
        fact[0]=1;
        long mod=998244353;
        long denf[]=new long[m+1];
        denf[0]=1;
        for(int i=1;i<=m;i++){
//            System.out.println(i);
            fact[i]=(fact[i-1]*i)%mod;
            denf[i]=modexp(fact[i],mod-2,mod);
        }
        long ans=0;
        for(int i=1;i<=m-n+2;i++){
            long num=fact[m-i];
            long den=(denf[n-2]*(denf[m-i-n+2]))%mod;
            long temp=(num*den)%mod;
            ans=(ans+temp)%mod;
        }
        System.out.println(ans);
    }
    public static long modexp(long a,long power,long mod){
        if(power==0){
            return 1;
        }
        if(power==1){
            return a;
        }
        long small=modexp(a,power/2,mod);
        long ans=(small%mod*small%mod)%mod;
        if(power%2!=0){
            ans=(ans%mod*a%mod)%mod;
        }
        return ans;
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Problem83D {
	public static long[] fac;
	public static long[] invFac;
	public static void main(String[] args) throws Exception {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer tokenizer = new StringTokenizer(reader.readLine());
		int n = Integer.parseInt(tokenizer.nextToken());
		int m = Integer.parseInt(tokenizer.nextToken());

		// brute force
		long modulo = 998244353;
		fac = new long[m + 1];
		invFac = new long[m + 1];
		fac[0] = 1;
		invFac[0] = modInverse(fac[0], modulo);
		for (int i = 1; i <= m; i++) {
			fac[i] = (fac[i - 1] * i) % modulo;
			invFac[i] = modInverse(fac[i], modulo);
		}

		long x = choose(m, n - 1, modulo);
		long sum = 0;
		for (int i = 1; i <= n - 2; i++) {
			System.out.println("X: " + x + " - " + (choose(n - 2, i, modulo) * i));
			sum = (sum + ((choose(n - 2, i, modulo) * i) % modulo) % modulo);
		}
		System.out.println(BigInteger.valueOf(x).multiply(BigInteger.valueOf(sum)).mod(BigInteger.valueOf(modulo)).longValueExact());

		/*long sum = 0;
		for (int i = 0; i < n; i++) {
			for (int j = n; j <= m; j++) {
				// highest element is j
				// ascending = C(j - 1, i)
				// descending = ascending * C(j - i, n - i - 1)
				// total combo = ascending * descending
				// = C(j - 1, i) ^ 2 * C(j - i, n - i - 1)
				long ascending = choose(j - 1, i, modulo);
				long descending = ascending * choose(j - i, n - i - 1, modulo) % modulo;
				sum += (ascending * descending) % modulo;
			}
		}
		System.out.println(sum);*/

		reader.close();
	}
	public static long modInverse(long n, long p) {
		return BigInteger.valueOf(n).modInverse(BigInteger.valueOf(p)).longValueExact();
	}
	public static long choose(int n, int r, long m) {
		if (r == 0) {
			return 1;
		}
		return ((((fac[n] * invFac[r]) % m) * invFac[n - r]) % m) % m;
	}
}

import java.io.*;
import java.util.*;

public class GFG {
	private static int MOD=998244353;
	private static long ncr(int n,int r){
		long ans=1;
		for(int i=1;i<=r;i++)
			ans=((ans*n-r+i)*pow(i,MOD-2))%MOD;
		return ans%MOD;
	}
	private static long pow(long n,long k){
		long x=1,y=n;
		while(k!=0){
			if(k%2==1){
				x=x*y;
				x%=MOD;
			}
			y=y*y;
			y%=MOD;
			k=k/2;
		}
		return x;
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//int t = Integer.parseInt(br.readLine().trim());
		//while (t-- != 0) {
			String s = br.readLine().trim();
			String ss[]=s.split("\\s+");
			int n=Integer.parseInt(ss[0]);
			int m=Integer.parseInt(ss[1]);
			long ans=0;
			if(n>2){
    			ans=ncr(m,n-1);
    			ans=(ans*(n-2))%MOD;
    			ans=(ans*pow(2,n-3))%MOD;
			}
			System.out.println(ans);
		//}
	}
}

import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.Point;

public class Main {
	static final long MOD = 998244353L;
	static final long INF = 1000000000000000007L;
	//static final long MOD = 1000000007L;
	//static final int INF = 1000000007;

	//static long[] factorial;

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.ni();
		int M = sc.ni();
		long ans = 0;
		if (N==2) {
			ans = 0;
		} else if (N==3) {
			ans = (M-0L)*(M-1L)/2;
		} else {
			long[] fac = new long[200001];
			fac[0] = 1L;
			for (int i = 1; i <= 200000; i++)
				fac[i] = (fac[i-1]*i)%MOD;

			long C = ((N-2+MOD)*(power(2,N-2,MOD)-power(2,N-3,MOD)+MOD))%MOD;

			for (int k = N-1; k <= M; k++) {
				long num = fac[k-1];
				long den = (fac[N-2]*fac[k-N+1])%MOD;
				long choose = (num*power(den,MOD-2,MOD))%MOD;

				ans = (ans+C*choose)%MOD;
			}
		}
		pw.println(ans);
		pw.close();
	}

	public static long dist(long[] p1, long[] p2) {
		return (Math.abs(p2[0]-p1[0])+Math.abs(p2[1]-p1[1]));
	}

	//Find the GCD of two numbers
	public static long gcd(long a, long b) {
		if (a < b) return gcd(b,a);
		if (b == 0)
			return a;
		else
			return gcd(b,a%b);
	}

	//Fast exponentiation (x^y mod m)
	public static long power(long x, long y, long m) {
		if (y < 0) return 0L;
		long ans = 1;
		x %= m;
		while (y > 0) {
			if(y % 2 == 1)
				ans = (ans * x) % m;
			y /= 2;
			x = (x * x) % m;
		}
		return ans;
	}

	public static int[][] shuffle(int[][] array) {
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		return array;
	}

    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)

		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] a, int[] b) {
				  //return a[0]-b[0]; //ascending order
				  if (a[1] != b[1]) {
					  return (a[1]-b[1]);
				  } else {
					  return (a[0]-b[0]);
				  }
	          }
		});
		return array;
	}

    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] a, long[] b) {
				  if (a[0] < b[0])
					  return -1;
				  else if (a[0] > b[0])
					  return 1;
				  else
					  return 0;
	          }
		});
		return array;
	}

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int ni() {
            return Integer.parseInt(next());
        }

        long nl() {
            return Long.parseLong(next());
        }

        double nd() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.util.*;
import java.io.*;
public class Main {
    static FastReader in=new FastReader();
    static StringBuilder Sd=new StringBuilder();
    static List<Integer>Gr[];
    static long Mod=998244353;
    static boolean visit[];

    public static void main(String [] args) {
    	//Dir by MohammedElkady
    	int n=in.nextInt(),m=in.nextInt();

    	long ans=nCrModPFermat(m,n-1,Mod);
    	ans%=Mod;
    	ans*=(long)(n-2);
    	ans*=posation(n);
    	ans%=Mod;
    	Soutln((ans+Mod)%Mod+"");
    Sclose();

}
    static long power(long x, long y, long p)
    {

        // Initialize result
        long res = 1;

        // Update x if it is more than or
        // equal to p
        x = x % p;

        while (y > 0)
        {

            // If y is odd, multiply x
            // with result
            if (y % 2 == 1)
                res = (res * x) % p;

            // y must be even now
            y = y >> 1; // y = y/2
            x = (x * x) % p;
        }

        return res;
    }

    // Returns n^(-1) mod p
    static long modInverse(long n, long p)
    {
        return power(n, p-2, p);
    }

    // Returns nCr % p using Fermat's
    // little theorem.
    static long nCrModPFermat(int n, int r,
                                    long p)
    {

        // Base case
        if (r == 0)
            return 1;

        // Fill factorial array so that we
        // can find all factorial of r, n
        // and n-r
        long[] fac = new long[n+1];
        fac[0] = 1;

        for (int i = 1 ;i <= n; i++)
            fac[i] = fac[i-1] * i % p;

        return (fac[n]* modInverse(fac[r], p)
                % p * modInverse(fac[n-r], p)
                                    % p) % p;
    }
    static long fac(int n , int m,int l) {
    	long res=1;
    	for(int i=l,u=1;i<=n||u<=m;i++,u++) {
    		if(i<=n) {res*=i;}
    		if(u<=m) {res/=u;}
    		while(res>Mod)
    		res-=Mod;
    	}
    	return res;
    }
    static long posation(int n) {
     long res=1;
     for(int i=0;i<n-3;i++) {res*=2L;
     while(res>Mod)
     res-=Mod;}
     return res;
    }

    static long gcd(long g,long x){
        if(x<1)return g;
        else return gcd(x,g%x);
    }
    //array fill
    static long[]filllong(int n){long a[]=new long[n];for(int i=0;i<n;i++)a[i]=in.nextLong();return a;}
    static int[]fillint(int n){int a[]=new int[n];for(int i=0;i<n;i++)a[i]=in.nextInt();return a;}
    //OutPut Line
    static void Sout(String S) {Sd.append(S);}
    static void Soutln(String S) {Sd.append(S+"\n");}
    static void Soutf(String S) {Sd.insert(0, S);}
    static void Sclose() {System.out.println(Sd);}
    static void Sclean() {Sd=new StringBuilder();}
}
 class tosolve{
	 ArrayList<node>no=new ArrayList();
	 void sort() {
		 Collections.sort(no);
	 }
    void add(node o) {
    	no.add(o);
    }
 }
class node implements Comparable<node>{
int l,r;
	node(int x,int p){
		this.l=x;
		this.r=p;
	}
	@Override
	public int compareTo(node o) {
       return (l-o.l);
	}
}
class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
}

class Sorting{

 public static int[] bucketSort(int[] array, int bucketCount) {

 if (bucketCount <= 0) throw new IllegalArgumentException("Invalid bucket count");

 if (array.length <= 1) return array; //trivially sorted

 int high = array[0];

 int low = array[0];

 for (int i = 1; i < array.length; i++) { //find the range of input elements

 if (array[i] > high) high = array[i];

 if (array[i] < low) low = array[i];

 }

 double interval = ((double)(high - low + 1))/bucketCount; //range of one bucket

 ArrayList<Integer> buckets[] = new ArrayList[bucketCount];

 for (int i = 0; i < bucketCount; i++) { //initialize buckets

 buckets[i] = new ArrayList();

 }

 for (int i = 0; i < array.length; i++) { //partition the input array

 buckets[(int)((array[i] - low)/interval)].add(array[i]);

 }

 int pointer = 0;

 for (int i = 0; i < buckets.length; i++) {

 Collections.sort(buckets[i]); //mergeSort

 for (int j = 0; j < buckets[i].size(); j++) { //merge the buckets

 array[pointer] = buckets[i].get(j);

 pointer++;

 }

}

return array;

}
}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.InputMismatchException;

/**
 * @author Mubtasim Shahriar
 */

public class CountArray {

	public static void main(String[] args) {

		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader sc = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solver solver = new Solver();
		//		int t = sc.nextInt();
		int t = 1;
		while(t--!=0) {
			solver.solve(sc, out);
		}
		out.close();

	}
	static final int MAXN = 200000 + 10;;
	static long MOD = 998244353l;
	static long[] fact;

	static class Solver {
		public void solve(InputReader sc, PrintWriter out) {
			long n = sc.nextInt();
			long m = sc.nextInt();
			if(n==2) {
				out.println(m);
				return;
			}
			fact = new long[MAXN];
			fact[0] = 1;
			for(long i = 1; i < MAXN; i++) {
				fact[(int)i] = i*fact[(int)i-1] % MOD;
			}
			long ans = ncr(m,n-1) * (n-2);
			ans %= MOD;
			ans *= power(2,n-3);
			ans %= MOD;
			out.println(ans);
		}

	}

	static long power(long x, long y) {
		long res = 1;
		x %= MOD;

		while(y > 0) {
			if(y%2==1) res = (res*x) % MOD;
			y = y >> 1;
			x = (x*x) % MOD;
		}

		return res;
	}

	static long modInv(long n) {
		return power(n, MOD-2);
	}

	static long ncr(long n, long r) {
		if(r==0) return 1;
		int nt = (int) n;
		int rt = (int) r;
		return (fact[nt]*modInv(fact[rt])%MOD * modInv(fact[nt-rt])%MOD)%MOD;
	}

	static class InputReader {
		private boolean finished = false;

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1) {
				throw new InputMismatchException();
			}
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1) {
				return -1;
			}
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				if (Character.isValidCodePoint(c)) {
					res.appendCodePoint(c);
				}
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null) {
				return filter.isSpaceChar(c);
			}
			return isWhitespace(c);
		}

		public static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private String readLine0() {
			StringBuilder buf = new StringBuilder();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r') {
					buf.appendCodePoint(c);
				}
				c = read();
			}
			return buf.toString();
		}

		public String readLine() {
			String s = readLine0();
			while (s.trim().length() == 0) {
				s = readLine0();
			}
			return s;
		}

		public String readLine(boolean ignoreEmptyLines) {
			if (ignoreEmptyLines) {
				return readLine();
			} else {
				return readLine0();
			}
		}

		public BigInteger readBigInteger() {
			try {
				return new BigInteger(nextString());
			} catch (NumberFormatException e) {
				throw new InputMismatchException();
			}
		}

		public char nextCharacter() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			return (char) c;
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E') {
					return res * Math.pow(10, nextInt());
				}
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E') {
						return res * Math.pow(10, nextInt());
					}
					if (c < '0' || c > '9') {
						throw new InputMismatchException();
					}
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public boolean isExhausted() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1) {
				read();
			}
			return value == -1;
		}

		public String next() {
			return nextString();
		}

		public SpaceCharFilter getFilter() {
			return filter;
		}

		public void setFilter(SpaceCharFilter filter) {
			this.filter = filter;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
		public int[] nextIntArray(int n){
			int[] array=new int[n];
			for(int i=0;i<n;++i)array[i]=nextInt();
			return array;
		}
		public int[] nextSortedIntArray(int n){
			int array[]=nextIntArray(n);
			Arrays.sort(array);
			return array;
		}
		public int[] nextSumIntArray(int n){
			int[] array=new int[n];
			array[0]=nextInt();
			for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
			return array;
		}
		public long[] nextLongArray(int n){
			long[] array=new long[n];
			for(int i=0;i<n;++i)array[i]=nextLong();
			return array;
		}
		public long[] nextSumLongArray(int n){
			long[] array=new long[n];
			array[0]=nextInt();
			for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
			return array;
		}
		public long[] nextSortedLongArray(int n){
			long array[]=nextLongArray(n);
			Arrays.sort(array);
			return array;
		}
	}

}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.InputMismatchException;

/**
 * @author Mubtasim Shahriar
 */

public class CountArray {

	public static void main(String[] args) {

		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader sc = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solver solver = new Solver();
//		int t = sc.nextInt();
		int t = 1;
		while(t--!=0) {
			solver.solve(sc, out);
		}
		out.close();

	}

	static class Solver {
		public void solve(InputReader sc, PrintWriter out) {
			long n = sc.nextInt();
			long m = sc.nextInt();
			long mod = 998244353l;
			long ncr = nCrModPFermat(m,n-1,mod);
			long last = ((n-1)*(n-2))/2;
			last %= mod;
			out.println((ncr*last)%mod);
		}
	}

//	static long nCrModp(long n, long r, long p)
//
//    {
//
//        // The array C is going to store last
//
//        // row of pascal triangle at the end.
//
//        // And last entry of last row is nCr
//
//        long C[]=new long[(int)r+1];
//
//        Arrays.fill(C,0);
//
//
//
//        C[0] = 1; // Top row of Pascal Triangle
//
//
//
//        // One by constructs remaining rows of Pascal
//
//        // Triangle from top to bottom
//
//        for (int i = 1; i <= n; i++)
//
//        {
//
//            // Fill entries of current row using previous
//
//            // row values
//
//            for (int j = Math.min(i, (int)r); j > 0; j--)
//
//
//
//                // nCj = (n-1)Cj + (n-1)C(j-1);
//
//                C[j] = (C[j] + C[j-1])%p;
//
//        }
//
//        return C[(int)r];
//
//    }

	static long power(long x, long y, long p)

    {

        // Initialize result

        long res = 1;

        // Update x if it is more than or

        // equal to p

        x = x % p;

        while (y > 0)

        {

            // If y is odd, multiply x

            // with result

            if (y % 2 == 1)

                res = (res * x) % p;

            // y must be even now

            y = y >> 1; // y = y/2

            x = (x * x) % p;

        }

        return res;

    }

    // Returns n^(-1) mod p

    static long modInverse(long n, long p)

    {

        return power(n, p-2, p);

    }

    // Returns nCr % p using Fermat's

    // little theorem.

    static long nCrModPFermat(long n, long r,

                                    long p)

    {

        // Base case

        if (r == 0)

            return 1;

        // Fill factorial array so that we

        // can find all factorial of r, n

        // and n-r

        long[] fac = new long[(int)n+1];

        fac[0] = 1;

        for (int i = 1 ;i <= n; i++)

            fac[i] = fac[i-1] * i % p;

        return (fac[(int)n]* modInverse(fac[(int)r], p)

                % p * modInverse(fac[(int)n-(int)r], p)

                                    % p) % p;

    }

	static class InputReader {
		private boolean finished = false;

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1) {
				throw new InputMismatchException();
			}
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1) {
				return -1;
			}
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				if (Character.isValidCodePoint(c)) {
					res.appendCodePoint(c);
				}
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null) {
				return filter.isSpaceChar(c);
			}
			return isWhitespace(c);
		}

		public static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private String readLine0() {
			StringBuilder buf = new StringBuilder();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r') {
					buf.appendCodePoint(c);
				}
				c = read();
			}
			return buf.toString();
		}

		public String readLine() {
			String s = readLine0();
			while (s.trim().length() == 0) {
				s = readLine0();
			}
			return s;
		}

		public String readLine(boolean ignoreEmptyLines) {
			if (ignoreEmptyLines) {
				return readLine();
			} else {
				return readLine0();
			}
		}

		public BigInteger readBigInteger() {
			try {
				return new BigInteger(nextString());
			} catch (NumberFormatException e) {
				throw new InputMismatchException();
			}
		}

		public char nextCharacter() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			return (char) c;
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E') {
					return res * Math.pow(10, nextInt());
				}
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E') {
						return res * Math.pow(10, nextInt());
					}
					if (c < '0' || c > '9') {
						throw new InputMismatchException();
					}
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public boolean isExhausted() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1) {
				read();
			}
			return value == -1;
		}

		public String next() {
			return nextString();
		}

		public SpaceCharFilter getFilter() {
			return filter;
		}

		public void setFilter(SpaceCharFilter filter) {
			this.filter = filter;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
		public int[] nextIntArray(int n){
			int[] array=new int[n];
			for(int i=0;i<n;++i)array[i]=nextInt();
			return array;
		}
		public int[] nextSortedIntArray(int n){
			int array[]=nextIntArray(n);
			Arrays.sort(array);
			return array;
		}
		public int[] nextSumIntArray(int n){
			int[] array=new int[n];
			array[0]=nextInt();
			for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
			return array;
		}
		public long[] nextLongArray(int n){
			long[] array=new long[n];
			for(int i=0;i<n;++i)array[i]=nextLong();
			return array;
		}
		public long[] nextSumLongArray(int n){
			long[] array=new long[n];
			array[0]=nextInt();
			for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
			return array;
		}
		public long[] nextSortedLongArray(int n){
			long array[]=nextLongArray(n);
			Arrays.sort(array);
			return array;
		}
	}

}

import java.util.*;
import java.io.*;

public class dsu {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		int mod = 998244353;

		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());

		if (n == 2)
			System.out.println(n);
		else
			System.out.println((((nCrModPFermat(m,n-1, mod) % mod * (n - 2)) % mod) * power(2, n - 3,mod)) % mod);
		pw.flush();
	}

	static int gcd(int a, int b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		pair(int r, int t) {
			x = r;
			y = t;
		}

		public String toString() {
			return "(" + x + "," + y + ")";
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			return o.x - x;
		}

	}

	static long power(long x, long y, int p) {

		// Initialize result
		long res = 1;

		// Update x if it is more than or
		// equal to p
		x = x % p;

		while (y > 0) {

			// If y is odd, multiply x
			// with result
			if (y % 2 == 1)
				res = (res * x) % p;

			// y must be even now
			y = y >> 1; // y = y/2
			x = (x * x) % p;
		}

		return res;
	}

	// Returns n^(-1) mod p
	static long modInverse(long n, int p) {
		return power(n, p - 2, p);
	}

	// Returns nCr % p using Fermat's
	// little theorem.
	static long nCrModPFermat(int n, int r, int p) {

		// Base case
		if (r == 0)
			return 1;

		// Fill factorial array so that we
		// can find all factorial of r, n
		// and n-r
		long[] fac = new long[n + 1];
		fac[0] = 1;

		for (int i = 1; i <= n; i++)
			fac[i] = (fac[i - 1] * i) % p;

		return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
	}

}

import java.util.*;
import java.io.*;
public class HelloWorld{

    private static long modInverse(long n, long p){
        return pow(n, p-2, p)%p;
    }

    private static long pow(long n, long p, long mod){
        if(p == 0)  return (long)1;
        if(p == 1)  return (n%mod);

        long ans = pow(n, p/2, mod)%mod;
        ans = (ans%mod * ans%mod)%mod;

        if(p%2 == 1)
            ans = (ans%mod * n%mod)%mod;

        return ans;
    }

    public static void main(String []args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt(), m = sc.nextInt(), lim = Math.max(m, n);

        long mod = 998244353, fact[] = new long[lim+1];

        if(n == 2){
            System.out.println(+m%mod);
            System.exit(0);
        }

        fact[0] = 1;
        for(int i=1; i<=lim; i++)
            fact[i] = (fact[i-1]%mod * i%mod)%mod;

        long ans = fact[m];
        ans = (ans%mod * modInverse(fact[n-1], mod)%mod)%mod;
        ans = (ans%mod * modInverse(fact[m-n+1], mod)%mod)%mod;
        ans = (ans%mod * pow(2, n-3, mod)%mod)%mod;
        ans = (ans%mod * (n-2)%mod)%mod;

        System.out.println(+ans%mod);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class D {
	static int N, M;
	static final long p = 998244353;
	static long factor[];

	static long Uclede(long a, long b) {
		long[] s = new long[2];
		long[] t = new long[2];
		s[0] = 1;
		t[0] = 0;
		s[1] = 0;
		t[1] = 1;
		while (a % b != 0) {
			long ss = (s[0] - (a / b) * s[1]) ;
			long tt = (t[0] - (a / b) * t[1]) ;

			s[0] = s[1];
			t[0] = t[1];
			s[1] = ss;
			t[1] = tt;
			long tmp = a % b;
			a = b;
			b = tmp;
		}
		return t[1] < 0 ? t[1] + p : t[1];

	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		N = Integer.parseInt(st.nextToken());
		M = Integer.parseInt(st.nextToken());

		factor = new long[M + 1];
		factor[1] = 1;

		for (int m = 2; m <= M; m++) {
			factor[m] = (m * factor[m - 1]) % p;
		}
		long Answer = 1;
		Answer = (Answer * factor[M]) %p;
		Answer = (Answer * Uclede(p,(factor[M-N+1] * factor[N-1])%p)) %p;
		Answer = (Answer * (N-2)) %p;
		Answer = (Answer * (long)Math.pow(2, N-3)) %p;
		System.out.println(Answer);
	}
}