#include<bits/stdc++.h>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;

constexpr int mod = 1000000007;
#define ll long long

template<ll M = mod>
class ModInt {
public:
    ModInt(ll data = 0) : data((data % M + M) % M) {}

    inline ModInt<M> &operator+=(ModInt<M> const &right) {
        data += right.data;
        data = data > M ? data - M : data;
        return *this;
    }

    inline ModInt<M> &operator-=(ModInt<M> const &right) {
        data -= right.data;
        data = data < 0 ? data + M : data;
        return *this;
    }

    inline ModInt<M> &operator*=(ModInt<M> const &right) {
        data = data * right.data % M;
        data = data < 0 ? data + M : data;
        return *this;
    }

    inline bool operator==(ModInt<M> const &right) const {
        return data == right.data;
    }

    inline bool operator!=(ModInt<M> const &right) const {
        return !(*this == right);
    }

    inline bool operator<(ModInt<M> const &right) const {
        return data < right.data;
    }

    inline ll value() const {
        return data;
    }

    //k!
    static ModInt<M> Fact(int k) {
        if (k < 0)return 0;
        if (fact.size() >= k + 1)return fact[k];

        int calculated = fact.size();//計算済み
        fact.resize(k + 1);
        fact_inv.resize(k + 1);
        if (calculated == 0) {
            fact[0] = fact_inv[0] = 1;
            calculated = 1;
        }
        for (int i = calculated; i <= k; ++i) {
            fact[i] = fact[i - 1] * i;
        }
        fact_inv[k] = pow(fact[k], M - 2);
        for (int i = k - 1; i >= calculated; --i) {
            fact_inv[i] = fact_inv[i + 1] * (i + 1);
        }
        return fact[k];
    }

    //1/k!
    static ModInt<M> Fact_inv(int k) {
        if (k < 0)return 0;
        Fact(k);
        return fact_inv[k];
    }

private:
    ll data;
    static vector<ModInt<M>> fact;
    static vector<ModInt<M>> fact_inv;
};

template<ll M> vector<ModInt<M>> ModInt<M>::fact = vector<ModInt<M>>();
template<ll M> vector<ModInt<M>> ModInt<M>::fact_inv = vector<ModInt<M>>();

template<ll M>
inline ModInt<M> operator+(const ModInt<M> &left, const ModInt<M> &right) {
    return ModInt<M>(left) += right;
}

template<ll M>
ModInt<M> operator+(int left, const ModInt<M> &right) {
    return ModInt<M>(left) + ModInt<M>(right);
}

template<ll M>
ModInt<M> operator+(const ModInt<M> &left, int right) {
    return ModInt<M>(left) + ModInt<M>(right);
}

template<ll M>
inline ModInt<M> operator-(const ModInt<M> &left, const ModInt<M> &right) {
    return ModInt<M>(left) -= right;
}

template<ll M>
ModInt<M> operator-(int left, const ModInt<M> &right) {
    return ModInt<M>(left) - ModInt<M>(right);
}

template<ll M>
ModInt<M> operator-(const ModInt<M> &left, int right) {
    return ModInt<M>(left) - ModInt<M>(right);
}

template<ll M>
inline ModInt<M> operator*(const ModInt<M> &left, const ModInt<M> &right) {
    return ModInt<M>(left) *= right;
}

template<ll M>
ModInt<M> operator*(int left, const ModInt<M> &right) {
    return ModInt<M>(left) * ModInt<M>(right);
}

template<ll M>
ModInt<M> operator*(const ModInt<M> &left, int right) {
    return ModInt<M>(left) * ModInt<M>(right);
}

template<ll M>
inline ostream &operator<<(ostream &os, const ModInt<M> mi) {
    os << mi.value();
    return os;
}

template<ll M>
ModInt<M> pow(ModInt<M> a, ll b) {
    ModInt<M> res = 1;
    while (b) {
        if (b & 1)res *= a;
        b >>= 1;
        a *= a;
    }
    return res;
}

template<ll M>
ModInt<M> comb(int n, int r) {
    return ModInt<mod>::Fact(n) * ModInt<mod>::Fact_inv(r) * ModInt<mod>::Fact_inv(n - r);
}

signed main() {
    int N, K;
    cin >> N >> K;
    ModInt<mod> ans = 0;
    //空き部屋がi個になる
    for (int i = 0; i <= N - 1; ++i) {
        if (i > K)break;
        ans += comb<mod>(N, i) * comb<mod>(N - 1, i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7940