#include <bits/stdc++.h>

using namespace std;

#define int long long

const int mod = 1e9 + 7;

int bp(int a, int b) {
    if (b == 0) return 1;
    int val = bp(a, b / 2);
    if (b % 2) return (val * ((val * a) % mod)) % mod;
    return (val * val) % mod;
}

int divv(int a, int b) {
    return a * bp(b, mod - 2) % mod;
}

void solve() {
    int n, k;
    cin >> n >> k;
    int ans = 1;
    int tc1 = 1, tc2 = 1;
    for (int i = 0; i < min(k, n); ++i) {
        tc1 = (tc1 * (n - i)) % mod;
        tc1 = divv(tc1, 1 + i);
        tc2 = (tc2 * (n - 1 - i)) % mod;
        tc2 = divv(tc2, 1 + i);
        ans = (ans + tc1 * tc2) % mod;
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}
