#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

#define DEBUG(fmt, ...)
//#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;

ll gcd(ll x, ll y){
    if(y == 0){ return x;}
    return gcd(y, x%y);
}

ll extgcd(ll a, ll b, ll &x , ll &y){
    if( b == 0 ){
        x = 1; y = 0; return a;
    }
    ll q = a/b;
    ll g = extgcd(b, a-q*b, x, y);
    ll z = x - q*y;
    x = y, y = z;
    return g;
}

ll lcm(ll x, ll y){
    // TODO:
    return 0;
}

bool isPrime(ll x){
    if( x == 1 ){
        return false; // by definition of prime
    }

    for(int i = 2; i*i <=x; i++){
        if( x % i == 0 ){
            return false;
        }
    }
    return true;
}

template<ll _M=1000000007>
class FactorialProvider{
public:
    FactorialProvider(){};
    ~FactorialProvider(){};

    ll operator() (ll x) {
        ll ret = 1;
        for(ll i = 1; i <= x; i++){
            ret = (ret*i%_M)%_M;
        }
        return ret;
    }
};

template<ll _M=1000000007>
class PrecomputedFactorialProvider{
public:
    PrecomputedFactorialProvider():_max(0){
        _facto.push_back(1);
        _factoinv.push_back(1);
    };

    ~PrecomputedFactorialProvider(){};

    ll operator() (ll x) {
        return facto(x);
    }

    ll facto(ll x){
        if( x > _max ){
            ll cur = _facto[_max];
            _facto.resize(x+1);
            for( ll i = _max+1; i <= x; i++ ){
                cur = (cur * i)%_M;
                _facto[i] = cur;

            }

            _factoinv.resize(x+1);
            ll a, b;
            extgcd(_facto[x], _M, a, b);
            _factoinv[x] = (a+_M)%_M;
            for( ll i = x; i > _max+1; i-- ){
                _factoinv[i-1] = (_factoinv[i]*i)%_M;
            }

            _max = x;
        }
        return _facto[x];
    }

    ll inv(ll x){
        if( x > _max){
            facto(x);
        }
        return _factoinv[x];
    }
private:
    vector<ll> _facto;
    vector<ll> _factoinv;
    ll _max;
};

template<ll _M=1000000007, class FProvider=PrecomputedFactorialProvider<_M>>
class Modulo{
public:
    Modulo():_num(0){}
    Modulo(ll num):_num(num%_M){};
    ~Modulo(){};

    ll num(){ return _num;};
    explicit operator ll() { return _num;};

    Modulo<_M>& add(const Modulo<_M>& rhs){
        // TODO: check overflow
        _num = (_num + rhs._num)%_M;
        return *this;
    }

    Modulo<_M>& sub(const Modulo<_M>& rhs){
        // TODO: check overflow
        _num = ((_num - rhs._num)%_M + _M)%_M;
        return *this;
    }

    Modulo<_M>& mul(const Modulo<_M>& rhs){
        // TODO: check overflow
        _num = (_num * rhs._num)%_M;
        return *this;
    }

    Modulo<_M>& div(const Modulo<_M>& rhs){
        // TODO: check overflow
        this->mul(rhs.inv());
        return *this;
    }

    Modulo<_M>& pow(ll n){
        ll cur = _num;
        _num = 1;
        while( n != 0 ){
            if( n & 1 ) _num = (_num * cur)%_M;
            cur = (cur * cur)%_M;
            n>>=1;
        }
        return *this;
    }

    Modulo<_M> inv() const{
        ll x, y;
        extgcd(_num, _M, x, y);
        return (x+_M)%_M;
    }

    Modulo<_M> facto() const{
        return _fprovider(_num);
    }

    Modulo<_M> factoinv() const{
        return _fprovider.inv(_num);
    }

    // https://stackoverflow.com/questions/9787593/implicit-type-conversion-with-template/9789036#9789036
    friend Modulo<_M> operator+(const Modulo<_M>& lhs, const Modulo<_M>& rhs){ return Modulo<_M>(lhs).add(rhs); }
    friend Modulo<_M> operator-(const Modulo<_M>& lhs, const Modulo<_M>& rhs){ return Modulo<_M>(lhs).sub(rhs); }
    friend Modulo<_M> operator*(const Modulo<_M>& lhs, const Modulo<_M>& rhs){ return Modulo<_M>(lhs).mul(rhs); }
    friend Modulo<_M> operator/(const Modulo<_M>& lhs, const Modulo<_M>& rhs){ return Modulo<_M>(lhs).div(rhs); }
    friend bool  operator==(Modulo<_M>& lhs, const Modulo<_M>& rhs){ return lhs._num == rhs._num; }

    friend Modulo<_M> combination(const Modulo<_M>& lhs, const Modulo<_M>& rhs){
        return lhs.facto() * rhs.factoinv() * (lhs-rhs).factoinv();
    }

private:
    ll _num;
    static FProvider _fprovider;

};

template<ll _M, class FProvider> FProvider Modulo<_M, FProvider>::_fprovider;


int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll n, k;

    cin >> n >> k;

    Modulo<MOD> ans;
    for(int i = 0; i < n && i <= k; i++ ){
        // nCi * (n-i)Hi -> nCi * (n-1)Ci
        Modulo<MOD> tmp = combination(Modulo<MOD>(n),i) * combination(Modulo<MOD>(n-1),i);
        // DEBUG("i=%d  tmp=%lld", i, tmp);
        ans = ans + tmp;
    }

    cout << ll(ans) << endl;
}


Measured memory_bytes: 7012