#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)
#define pi 3.141592653589793238462643

ll modexp(ll a, ll b, ll m){
    if (b==0)
        return 1;
    ll temp = modexp(a,b/2,m);
    temp = (temp*temp)%m;
    if (b&1)
        return (temp*(a%m))%m; // if b is odd a^b = a^(b/2)*a^(b/2)*a
    return temp;
}

// ll gcdExtended(ll a, ll b, ll *x, ll *y); 
// ll modInverse(ll b, ll m) { 
//     ll x, y;
//     ll g = gcdExtended(b, m, &x, &y); 
//     if (g != 1) return -1; 
//     return (x%m + m) % m; 
// } 
// ll modDivide(ll a, ll b, ll m) { 
//     a = a % m; 
//     ll inv = modInverse(b, m); 
//     if (inv == -1) 
//        return -1; 
//     else
//        return (inv * a) % m; 
// } 
// ll gcdExtended(ll a, ll b, ll *x, ll *y) { 
//     if (a == 0) { 
//         *x = 0, *y = 1; 
//         return b; 
//     } 
//     ll x1, y1;
//     ll gcd = gcdExtended(b%a, a, &x1, &y1); 
//     *x = y1 - (b/a) * x1; 
//     *y = x1; 
//     return gcd; 
// } 
// ll f(ll n, ll r){
//     ll ans = 1;
//     for(ll i=0; i<r; i++){
//         ans = (ans * (n-i))%mod;
//     }
//     for(ll i=1; i<=r; i++){
//         ans = modDivide(ans, i, mod);
//     }
//     return ans;
// }

ll modInverse(ll a, ll m){
    return modexp(a, m-2, m);
}
ll fac[MAXN];
ll fun(ll n, ll r){
    ll ans = fac[n];
    ans = (ans * modInverse(fac[r], mod))%mod;
    ans = (ans * modInverse(fac[n-r], mod))%mod;
    assert(ans >= 0);
    return ans;
}

void solve(){

    fac[0] = 1;
    fac[1] = 1;
    for(ll i=2; i<MAXN; i++){
        fac[i] = (fac[i-1]*i)%mod;
    }


    ll n, k;
    cin>>n>>k;
    ll ans = 0;
    for(ll r=0; r<=min(n, k ); r++){
        ans = (ans + (fun(n, r)*fun(n-1, n-r-1))%mod)%mod;
    }
    print(ans);
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   
 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
    
}


Measured memory_bytes: 1792