#include #define rep(i,n) for (int i=0; i < (n); i++) using namespace std; using ll = long long; const int MAX = 510000; const int MOD = 998244353; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } ll mod = 998244353; long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main(){ ios::sync_with_stdio(false); ll N,M; cin>>N>>M; COMinit(); // 正方形を何カ所作れるか ll sq = M/N; // cerr << "sq: " << sq << endl; if(N>M){ cout << 1 << endl; return 0; } ll ans=0; for(ll i=0; i<=sq; i++){ ll ret=0; // 棒の個数 ll a = M - i*N; // cerr << "a: " << a << endl; // ll x = modpow(a+1, i, mod); // cerr << "x: " << x << endl; ll num = a + i; ll x = COM(num,i); ans += x; ans %= mod; } cout << ans << endl; }