#include<bits/stdc++.h>
using namespace std;
using Int = long long;

#define MOD 998244353
#define MAX_P 1100005
Int fact[MAX_P],inv[MAX_P],finv[MAX_P];

void init(Int mod){
  fact[0]=1;
  for(Int i=1;i<MAX_P;i++)
    fact[i]=(fact[i-1]*i)%mod;

  inv[1]=1;
  for(Int i=2;i<MAX_P;i++)
    inv[i]=inv[mod%i]*(mod-mod/i)%mod;
  
  finv[0]=1;
  for(Int i=1;i<MAX_P;i++)
    finv[i]=finv[i-1]*inv[i]%mod;
}

//only for prime mod
Int mod_comb3(Int n,Int k,Int mod){
  if(k<0||k>n) return 0;
  return fact[n]*finv[k]%mod*finv[n-k]%mod;
}

Int calc(Int n,Int k,Int i){
  Int j=k-i;
  Int res=0;
  res+=mod_comb3(k,i,MOD);
  res+=MOD-mod_comb3(k,j-(i-n+1),MOD);
  //cout<<n<<" "<<k<<" "<<i<<" "<<j<<":"<<res<<endl;
  return res%MOD;
}

//INSERT ABOVE HERE
signed main(){
  init(MOD);
  Int n,k;
  cin>>n>>k;
  Int ans=0;
  for(Int i=k;i>=n;i--){
    Int j=k-i;
    if(i-j<0) continue;
    ans+=calc(n,k-(i==j),i);
    ans%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}
