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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

template <int mod>
struct ModInt {
    ll x;
    ModInt() : x(0) {}
    ModInt(ll y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod - p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = 1LL * x * p.x % mod; return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
        ll a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }
    ModInt pow(ll n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }
    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }
};
const int mod = 1000000007;
using mint = ModInt<mod>;

template <typename T>
struct Combination {
    vector<T> _fac, _finv, _inv;

    Combination(int n) : _fac(n+1), _finv(n+1), _inv(n+1){
        _fac[0] = _finv[n] = _inv[0] = 1;
        for (int i = 1; i <= n; ++i) _fac[i] = _fac[i-1] * i;
        _finv[n] /= _fac[n];
        for (int i = n-1; i >= 0; --i) _finv[i] = _finv[i+1] * (i+1);
        for (int i = 1; i <= n; ++i) _inv[i] = _finv[i] * _fac[i-1];
    }
    inline T fac(int k) const { return _fac[k]; }
    inline T finv(int k) const { return _finv[k]; }
    inline T inv(int k) const { return _inv[k]; }

    T perm(int n, int k) const {
        return (k < 0 || n < k) ? 0 : fac(n) * finv(n-k);
    }
    T comb(int n, int k) const {
        return (k < 0 || n < k) ? 0 : fac(n) * finv(k) * finv(n-k);
    }
};
Combination<mint> C(200010);

mint v[200010];

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

    for (int i = 0; i <= n-1; ++i) {
        v[i] = C.comb(n, i) * C.comb(n-1, i); // 空き部屋を選んで残りの部屋に一人ずつ置いたとき、残りはi人で部屋はn-i個
    }
    for (int i = 0; i < 200000; ++i) {
        v[i+1] += v[i];
    }

    if (k >= n-1) cout << v[n-1] << endl;
    else cout << v[k] << endl;
}


Measured memory_bytes: 9396