N,M=map(int, input().split()) mod=998244353 n=10**6+100 inv_t=[0]+[1] for i in range(2,n): inv_t+=[inv_t[mod%i]*(mod-int(mod/i))%mod] kai=[1,1] rev_kai=[1,inv_t[1]] for i in range(2,n): kai.append(kai[-1]*i%mod) rev_kai.append(rev_kai[-1]*inv_t[i]%mod) def cmb(n,r): return kai[n]*rev_kai[r]*rev_kai[n-r]%mod ans=1 d=M//N d+=1 e=M%N for i in range(N): if i==e: d-=1 ans*=cmb(M,d) ans%=mod M-=d print(ans)