#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
//#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);

int n;

class m_int{
    public:
    int_fast32_t MOD = max_int;
    int_fast32_t d=0;
    m_int(int val=0){
        if (val >= MOD) { val %= MOD; } else if (val < 0) { val %= MOD; val += MOD; }d = val;
    }
    m_int operator =(const m_int x){
        this->d = x.d;
        return *this;
    }
    m_int operator+(const m_int another){
        m_int tmp;
        if(d+another.d>MOD){
            tmp.d = d+another.d-MOD;
            return tmp;
        }
        else{
            tmp.d = d+another.d;
            return tmp;
        }
    }
    m_int operator-(const m_int &another) const{
        m_int tmp;
        if(d-another.d<(int_fast32_t)0){
            tmp.d = d-another.d+MOD;
            return tmp;
        }
        else{
            tmp.d = d-another.d;
            return tmp;
        }
    }
    m_int operator*(const m_int &another) const{
        m_int tmp;
        tmp.d = d*another.d%MOD;
        return tmp;
    }
    m_int operator/(const m_int &another) const{
        m_int tmp;
        tmp.d = d/another.d%MOD;
        return tmp;
    }
    m_int operator+=(const m_int another){
        (*this) = (*this) + another;
        return *this;
    }
    m_int operator-=(const m_int another){
        (*this) = (*this) - another;
        return *this;
    }
    m_int operator*=(const m_int another){
        (*this) = (*this) * another;
        return *this;
    }
    bool operator<(const m_int &another) const{
        return d < another.d;
    }
    bool operator>(const m_int &another) const{
        return d > another.d;
    }
};
ostream& operator<<(std::ostream& os, const m_int& obj){
    // ここでストリームに obj を書き込みます。
    os << obj.d;
    return os;
}
istream& operator>>(std::istream& is, m_int& obj){
    // ここでストリームから obj を読み込みます。
    is >> obj.d;
    if( false ) is.setstate(std::ios::failbit);
    return is;
}

m_int factorical(int n){
    m_int tmp=1;
    REP(i,n){
        tmp *= i+1;
    }
    return tmp;
}
m_int modinv(m_int x,int m=max_int){
    int a = x.d;
    int b = m;
    int u = 1;
    int v = 0;
    while(b){
        int t = a/b;
        a -= t*b;
        swap(a,b);
        u -= t*v;
        swap(u,v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
m_int comb(m_int n,m_int r){
    if(r>n || n < 0 || r < 0) return 0;
    /*
    int nterms = min(r.d,n.d-r.d);
    m_int num=1,den=1;
    REP(i,nterms){
        num *= n-i;
        den *= i+1;
    }
    return num*modinv(den);
    */
    return factorical(n.d)*modinv(factorical(r.d))*modinv(factorical(n.d-r.d));
}


signed main(){
    int n,k;
    cin >> n >> k;
    if(n-1<=k){
        print(comb(n+n-1,n));
    }
    else{
        m_int ans=0;
        vector<m_int> con1(n);
        vector<m_int> con2(n);
        con1[0] = 1;
        con1[1] = n;
        con2[1] = n-1;
        FOR(i,2,n){
            con1[i] = con1[i-1]*(n-i+1)*modinv(i);
            con2[i] = con2[i-1]*(n-i)*modinv(i);
        }
        //Debug(con1);
        REP(i,k+1){
            m_int x = con1[i];
            m_int y = con2[n-i-1];
            //print(x*y);
            //x = comb(n,i);
            //y = comb(n-1,n-i-1);
            //print(x*y);
            ans += x*y;
        }
        print(ans);
    }
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 6528