#include <iostream>
// #include <cassert>
#include <vector>
#include <algorithm>
#include <climits>

#include <stack>
#include <queue>
// #include <deque>
// #include <set>
// #include <map>
// #include <string>
// #include <unordered_set>
// #include <unordered_map>

#include <tuple>
// #include <cmath>
// #include <numeric>

using namespace std;


typedef long long ll;
typedef pair<long,long> pll;
typedef pair<int,int> pii;
typedef pair<int,long> pil;
typedef pair<long,int> pli;
typedef pair<long long, long long> pllll;
typedef pair<long long, int> plli;
typedef pair<int,long long> pill;
typedef vector<vector<long long>> vvll;
typedef vector<vector<long>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<long long> vll;

#define emplace_back pb
const char el = '\n';
const ll M = 1000000007;
ll inv[200001];

void generateinverse(int n) {
    inv[1]=1;
    for (int i = 2; i<=n; ++i) {
        ll q = (M/i);
        ll rinv = inv[M%i];
        // ll q = M-q;
        inv[i] = ((M-q)*rinv)%M;
    }
}

ll modexp(ll b, ll p) {
    //invariant: C*base^pow = b^p
    ll C = 1; ll base = b, pow = p;

    while (pow>0) {
        if (pow%2==0) {
            base*=base;
            base%=M;
            pow/=2;
        } else {
            C*=base;
            C%=M;
            --pow;
        }
    }

    return C;
}

ll choose(int n, int k) {

    if (k==n) return (ll)1;
    ll num = 1;
    ll denom = 1;

    for (ll i = 1; i<=(ll)k; ++i) {
        num *= ((ll)n+1-i);
        num %= M;

        denom *= i;
        denom %= M;
    }

    ll denominv = modexp(denom,M-2);

    num *= denominv;
    num %= M;
    return num;


}
/*
Edge cases:


*/

int main() {
    // ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int n,k; cin>>n>>k; cin.ignore();
       generateinverse(n);


    if (k>=n-1) {
        //then any configuration is possible;

        // this is multinomial coefficient
        // cout<<"in easy case: every config is possible"<<el;
        
        //2n-1 choose n
        long long num = 1;
        long long denominv = 1;
        for (int i = 0; i<n; ++i) {
            num*= (2*n-1-i);
            num %= M;
            denominv *= inv[i+1];
            denominv %= M;
        }
        ll ans = num*denominv;
        ans %= M;
        cout<<ans<<el;
        return 0;
    }


    /*
    we will appoint x rooms to be zero;
    And the other rooms will have x people distributed into them
    SOme rooms will get 0, some will get 1,
    etc., but the total added must be x

    Say we range from x = 0 to x = min(n-1,k).

    Consider fixed x. How many ways
    to distribute x to the remaining n-x rooms?


    Arbitrarily number the rooms from 1 to n-x.
    We have x stars and want to distribute n-x-1 bars
    where the number of stars to the left of the bar
    equals the number we distributed to that room;

    Now this is a matter of having n-1 empty spaces
    and choosing x to be stars, n-1-x to be bars.

    
    So (#ways to choose x rooms from n rooms)
    *(n-1 choose x), and sum for x = 0 to
    x = min(n-1,k)

    Call min(n-1,k) = c; how can we sum

    (n choose x)*(n-1 choose x) from x = 0 to c?


    //we can do the first one in O(n) time;
    //then the next one is divideby first term,
    //then multiply by a second new term.

    //check x = 0: in this case, we compute
    //1; in other words, we have k>=2 moves 
    //and it is always possible to get the 
    //original configuration.



    */

   // n choose x?
   // x factorial on the bottom
   // n*(n-1)*...*(n-x+1) for n choose x
   // when x increases, we multiply by more terms;

   //for x = 0, we start with 

   ll ncxnum=1;
   ll nminus1cxnum=1;
   ll xfactinv = 1;

   ll c= min((ll)n-1,(ll)k);
   ll ret = 1; //corresponding to x = 0;
   for (ll x = 1; x<=c; ++x) {
       xfactinv *= inv[x];
       xfactinv %= M;
       ncxnum *= ((ll)n-x+1);
       nminus1cxnum *= ((ll)n-x);
       ncxnum %= M;
       nminus1cxnum %= M;
       ll ncxtimesnminusonecx = xfactinv*xfactinv;
       ncxtimesnminusonecx %= M;
       ncxtimesnminusonecx *= ncxnum;
       ncxtimesnminusonecx %= M;
       ncxtimesnminusonecx *= nminus1cxnum;
       ncxtimesnminusonecx %= M;
       ret += ncxtimesnminusonecx;
       ret %= M;
   }

    cout<<ret<<el;

}

Measured memory_bytes: 1792