#include using namespace std; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (int i = 0; i < (int)(n); i++) vector fact, factinv, inv; ll mod = 1e9 + 7; void prenCkModp(ll n) { fact.resize(n + 5); factinv.resize(n + 5); inv.resize(n + 5); fact.at(0) = fact.at(1) = 1; factinv.at(0) = factinv.at(1) = 1; inv.at(1) = 1; for (ll i = 2; i < n + 5; i++) { fact.at(i) = (fact.at(i - 1) * i) % mod; inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod; factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod; } } ll nCk(ll n, ll k) { if (n < k) return 0; return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod; } ll inva(ll N) { ll a = N, b = mod, c = 1, d = 0; while (b > 0) { ll t = a / b; a -= t * b; swap(a, b); c -= t * d; swap(c, d); } c %= mod; if (c < 0)c += mod; return c; } int main() { ll N,K; cin>>N>>K; prenCkModp(K+N+3); ll an=0; ll p=1; rep(i,N){ p*=(K+N-1-i); p%=mod; p*=inv[i+1]; p%=mod; } rep(k,min(N,K)){ an+=p; an%=mod; //cout<