#include #include #include #include #include #include #include #include #include #include using namespace std; struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<ostream &operator<<(ostream &o,const vector&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<= MOD) x-=MOD; return *this; } mint& operator-=(const mint a) { if ( (x+= MOD-a.x) >= MOD) x-= MOD; return *this; } mint& operator*=(const mint a) { (x*=a.x) %= MOD; return *this; } mint& operator/=(const mint a) { return (*this) *= a.inv();} mint operator+(const mint a) const { mint res(*this); return res+=a; } mint operator-(const mint a) const { mint res(*this); return res-=a; } mint operator*(const mint a) const { mint res(*this); return res*=a; } mint operator/(const mint a) const { mint res(*this); return res/=a; } mint inv() const { return pow(MOD-2);} friend ostream& operator<<(ostream &os, const mint a) noexcept { return os << a.x; } constexpr bool operator == (const mint& r) const noexcept { return this->x == r.x; } constexpr bool operator != (const mint& r) const noexcept { return this->x != r.x; } mint pow(long long t) const { if (!t) return mint(1); mint a = pow(t>>1); a*=a; if(t&1) a*= *this; return a; } }; struct combination { vector fact, ifact; // コンストラクタ combination(int n):fact(n+1),ifact(n+1) { fact[0] = mint(1); for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*mint(i); ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*mint(i); } mint nCr(int n, int r) { if (r < 0 || r > n) return 0; return fact[n]*ifact[r]*ifact[n-r]; } mint nPr(int n, int r) { if (r < 0 || r > n) return 0; return fact[n]*ifact[n-r]; } } comb(1000005); int main() { int64 n,m; cin >> n >> m; if (n==1) { cout << 1 << endl; return 0; } mint ans = 1; for (int64 i=1; i<=m/n; i++) { int64 rest = m - i*n; ans += comb.nCr(rest + i, i); } cout << ans << endl; }