#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
typedef long long ll;
const ll maxn = 1e6+10;
const ll mod = 1000000007;
ll n,k;
ll f1[maxn],f2[maxn],inv[maxn];

void init(){
    inv[1] = 1;
    for(int i = 2;i<maxn;i++) inv[i] = (mod-mod/i)*inv[mod%i]%mod;
    f1[0] = f2[0] = 1;
    for(int i = 1;i<maxn;i++){
        f1[i] = f1[i-1]*i%mod;
        f2[i] = f2[i-1]*inv[i]%mod;
    }
}

ll C(ll n,ll k){
    return f1[n]*f2[k]%mod*f2[n-k]%mod;
}

int main(){
    init();
    cin>>n>>k;
    ll res = 0;
    for(ll i = 0;i<=min(n-1,k);i++){
        res = (res + C(n,i)*C(n-1,n-i-1)%mod)%mod;
    }
    cout<<res<<endl;
    return 0;
}