N, K = map(int, input().split())

MOD = 10 ** 9 + 7
MAX = 4 * 10 ** 5 + 10
modinv = lambda a, mod=MOD: pow(a, mod - 2, mod)
fac, inv = [1] * MAX, [1] * MAX
for i in range(1, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = modinv(fac[i])
comb = lambda n, k: fac[n] * inv[k] * inv[n - k] % MOD

if K >= N - 1:
    print(comb(2 * N - 1, N - 1))
else:
    ans = 0
    for i in range(K + 1):
        ans = (ans + comb(N - 1, N - 1 - i) * comb(N, i)) % MOD
    print(ans) N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 MAX = 4 * 10 ** 5 + 10 MAX 4 * 10 ** 5 + 10 4 * 10 ** 5 4 10 ** 5 10 5 10 modinv = lambda a, mod=MOD: pow(a, mod - 2, mod) modinv lambda a, mod=MOD: pow(a, mod - 2, mod) pow(a, mod - 2, mod) pow a mod - 2 mod 2 mod a mod=MOD MOD fac, inv = [1] * MAX, [1] * MAX fac [1] * MAX [1] 1 MAX inv [1] * MAX [1] 1 MAX for i in range(1, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = modinv(fac[i]) i range(1, MAX) range 1 MAX fac[i] = fac[i - 1] * i % MOD fac[i] fac i fac[i - 1] * i % MOD fac[i - 1] * i fac[i - 1] fac i - 1 i 1 i MOD inv[i] = modinv(fac[i]) inv[i] inv i modinv(fac[i]) modinv fac[i] fac i comb = lambda n, k: fac[n] * inv[k] * inv[n - k] % MOD comb lambda n, k: fac[n] * inv[k] * inv[n - k] % MOD fac[n] * inv[k] * inv[n - k] % MOD fac[n] * inv[k] * inv[n - k] fac[n] * inv[k] fac[n] fac n inv[k] inv k inv[n - k] inv n - k n k MOD n k if K >= N - 1:
    print(comb(2 * N - 1, N - 1))
else:
    ans = 0
    for i in range(K + 1):
        ans = (ans + comb(N - 1, N - 1 - i) * comb(N, i)) % MOD
    print(ans) K >= N - 1 K N - 1 N 1 print(comb(2 * N - 1, N - 1)) print comb(2 * N - 1, N - 1) comb 2 * N - 1 2 * N 2 N 1 N - 1 N 1 ans = 0 ans 0 for i in range(K + 1):
        ans = (ans + comb(N - 1, N - 1 - i) * comb(N, i)) % MOD
     i range(K + 1) range K + 1 K 1 ans = (ans + comb(N - 1, N - 1 - i) * comb(N, i)) % MOD ans (ans + comb(N - 1, N - 1 - i) * comb(N, i)) % MOD ans + comb(N - 1, N - 1 - i) * comb(N, i) ans comb(N - 1, N - 1 - i) * comb(N, i) comb(N - 1, N - 1 - i) comb N - 1 N 1 N - 1 - i N - 1 N 1 i comb(N, i) comb N i MOD print(ans) print ans N, K = map(int, input().split()) map(int, input().split()) N comb = lambda n, k: fac[n] * inv[k] * inv[n - k] % MOD lambda n, k: fac[n] * inv[k] * inv[n - k] % MOD comb fac, inv = [1] * MAX, [1] * MAX [1] * MAX fac ans = 0 0 ans MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD MAX = 4 * 10 ** 5 + 10 4 * 10 ** 5 + 10 MAX modinv = lambda a, mod=MOD: pow(a, mod - 2, mod) lambda a, mod=MOD: pow(a, mod - 2, mod) modinv K = map(int, input().split()) map(int, input().split()) K ans = (ans + comb(N - 1, N - 1 - i) * comb(N, i)) % MOD (ans + comb(N - 1, N - 1 - i) * comb(N, i)) % MOD ans inv = [1] * MAX, [1] * MAX [1] * MAX inv
N, K = map(int, input().split())

MOD = 10 ** 9 + 7
MAX = 4 * 10 ** 5 + 10
modinv = lambda a, mod=MOD: pow(a, mod - 2, mod)
fac, inv = [1] * MAX, [1] * MAX
for i in range(1, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = modinv(fac[i])
comb = lambda n, k: fac[n] * inv[k] * inv[n - k] % MOD

if K >= N - 1:
    print(comb(2 * N - 1, N - 1))
else:
    ans = 0
    for i in range(K + 1):
        ans = (ans + comb(N - 1, N - 1 - i) * comb(N, i)) % MOD
    print(ans)
