#include <bits/stdc++.h>
#define LL long long
using namespace std;
const LL P = 1e9+7;

LL fp(LL a, LL n){
    if(n== 0)
        return 1;

    LL h = fp(a , n / 2);
    h = h*h %P;
    if(n&1){
        h = h * a %P;
    }

    return h;
}

vector<LL> fac(200010);
LL C(LL m, LL n){
    return fac[m] * fp(fac[m-n], P-2) % P * fp(fac[n], P-2) % P;
}
int main(){
    LL n,k;
    cin >>n>>k;

    fac[0] = fac[1] = 1;
    for(int i=2;i<=200000;i++){
        fac[i] = fac[i-1] * i % P;
    }

    LL ans = 0;

    for(int i=0;i<=min(n-1, k);i++){
        ans = ans + C(n, i) * C(n-1, i) % P;
        ans %= P;
    }

    cout <<ans;
}
