#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x

#define P (1'000'000'007)

inline int fast_pow(int x, int n, int mod) {
    long long signed res = 1;
    long long accumulation = x;
    for (int i = 0; n >> i > 0; ++ i) {
        if ((n >> i) % 2) {
            res *= accumulation;
            res %= mod;
        }
        accumulation *= accumulation;
        accumulation %= mod;
    }

    return res;
}

inline int fast_comb(int n, int r, int mod) {
    long long a = 1;
    long long b = 1;
    for (int i = 0; i < r; ++i) {
        a = a * (n - i) % mod;
        b = b * (i + 1) % mod;
    }

    b = fast_pow(b, mod - 2, mod);
    return a * b % mod;
}

template<int MOD=P>
struct Mod {
public:
    long long signed value;

    Mod(long long signed val): value(val % MOD) {
        if (value < 0) value += MOD;
    }

    constexpr Mod& operator+=(const Mod& other) noexcept { 
        value += other.value;
        value %= MOD;
        return *this;
    }
    constexpr Mod& operator-=(const Mod& other) noexcept {
        value -= other.value;
        if (value < 0) value += MOD;
        return *this;
    }
    constexpr Mod& operator*=(const Mod& other) noexcept {
        value *= other.value;
        value %= MOD;
        return *this;
    }

    constexpr Mod operator-() noexcept {
         return value == 0 ? 0 : MOD - value;
    }

    constexpr Mod operator+(const Mod& other) const noexcept { return Mod(*this) += other; }
    constexpr Mod operator-(const Mod& other) const noexcept { return Mod(*this) -= other; }
    constexpr Mod operator*(const Mod& other) const noexcept { return Mod(*this) *= other; }
    constexpr bool operator==(const Mod& other) const noexcept { return this->value == other.value; }
    constexpr bool operator!=(const Mod& other) const noexcept { return this->value != other.value; }
};

template<int MOD=P>
class Combination {
public:
    Combination(int n) {
        long long signed accumulation = 1;
        factorials.push_back(1);
        for (int i = 1; i <= n; ++ i) {
            accumulation *= i;
            accumulation %= MOD;
            factorials.push_back(accumulation);
        }

        int n_inv = fast_pow(factorials[n], MOD - 2, MOD);
        invs.push_back(n_inv);
        accumulation = n_inv;
        for (int i = n; i >= 2; --i) {
            accumulation *= i;
            accumulation %= MOD;
            invs.push_front(accumulation);
        }
        invs.push_front(1);
    }

    int comb(int n, int r) {
        long long signed res = 1ll * factorials[n] * invs[r] % MOD;
        return 1ll * res * invs[n - r] % MOD;
    }

    int perm(int n, int r) {
        long long signed res = 1ll * factorials[n] * invs[n - r] % MOD;
        return res;
    }

    std::deque<int> factorials;
    std::deque<int> invs;
};

signed main() {
    int n, k;
    cin >> n >> k;

    Combination comb(n);
    auto ans = Mod(0);
    rep(i, min(k + 1, n)) {
        auto res = Mod(comb.comb(n, i));
        res *= comb.comb(n - 1, n - i - 1);
        ans += res;
    }

    cout << ans.value;

    return 0;
}


Measured memory_bytes: 6360