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

MAX = 4 * 10 ** 5 + 1
MOD = 10 ** 9 + 7

# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1

# Inverse
inv = [0] * (MAX + 1)
inv[1] = 1

# Inverse factorial
finv = [0] * (MAX + 1)
finv[0] = 1
finv[1] = 1

for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD


def comb(n, k):
    if n < k or k < 0:
        return 0
    return (fac[n] * finv[k] * finv[n - k]) % MOD


if N - 1 <= K:
    print(comb(2 * N - 1, N - 1))
else:
    # zero: 0 ~ K
    ans = 0
    for n in range(K + 1):
        ans += comb(N, n) * comb(N - 1, n)
        ans %= MOD
    print(ans) N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K MAX = 4 * 10 ** 5 + 1 MAX 4 * 10 ** 5 + 1 4 * 10 ** 5 4 10 ** 5 10 5 1 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 fac = [0] * (MAX + 1) fac [0] * (MAX + 1) [0] 0 MAX + 1 MAX 1 fac[0] = 1 fac[0] fac 0 1 fac[1] = 1 fac[1] fac 1 1 inv = [0] * (MAX + 1) inv [0] * (MAX + 1) [0] 0 MAX + 1 MAX 1 inv[1] = 1 inv[1] inv 1 1 finv = [0] * (MAX + 1) finv [0] * (MAX + 1) [0] 0 MAX + 1 MAX 1 finv[0] = 1 finv[0] finv 0 1 finv[1] = 1 finv[1] finv 1 1 for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD i range(2, MAX + 1) range 2 MAX + 1 MAX 1 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] = MOD - inv[MOD % i] * (MOD // i) % MOD inv[i] inv i MOD - inv[MOD % i] * (MOD // i) % MOD MOD inv[MOD % i] * (MOD // i) % MOD inv[MOD % i] * (MOD // i) inv[MOD % i] inv MOD % i MOD i MOD // i MOD i MOD finv[i] = finv[i - 1] * inv[i] % MOD finv[i] finv i finv[i - 1] * inv[i] % MOD finv[i - 1] * inv[i] finv[i - 1] finv i - 1 i 1 inv[i] inv i MOD def comb(n, k):
    if n < k or k < 0:
        return 0
    return (fac[n] * finv[k] * finv[n - k]) % MOD comb if n < k or k < 0:
        return 0
     n < k or k < 0 n < k n k k < 0 k 0 return 0 0 return (fac[n] * finv[k] * finv[n - k]) % MOD (fac[n] * finv[k] * finv[n - k]) % MOD fac[n] * finv[k] * finv[n - k] fac[n] * finv[k] fac[n] fac n finv[k] finv k finv[n - k] finv n - k n k MOD n n k k if N - 1 <= K:
    print(comb(2 * N - 1, N - 1))
else:
    # zero: 0 ~ K
    ans = 0
    for n in range(K + 1):
        ans += comb(N, n) * comb(N - 1, n)
        ans %= MOD
    print(ans) N - 1 <= K N - 1 N 1 K 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 n in range(K + 1):
        ans += comb(N, n) * comb(N - 1, n)
        ans %= MOD
     n range(K + 1) range K + 1 K 1 ans += comb(N, n) * comb(N - 1, n) ans comb(N, n) * comb(N - 1, n) comb(N, n) comb N n comb(N - 1, n) comb N - 1 N 1 n ans %= MOD ans MOD print(ans) print ans MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD finv = [0] * (MAX + 1) [0] * (MAX + 1) finv MAX = 4 * 10 ** 5 + 1 4 * 10 ** 5 + 1 MAX ans += comb(N, n) * comb(N - 1, n) comb(N, n) * comb(N - 1, n) ans ans %= MOD MOD ans fac = [0] * (MAX + 1) [0] * (MAX + 1) fac K = map(int, input().split()) map(int, input().split()) K def comb(n, k):
    if n < k or k < 0:
        return 0
    return (fac[n] * finv[k] * finv[n - k]) % MOD def comb(n, k):
    if n < k or k < 0:
        return 0
    return (fac[n] * finv[k] * finv[n - k]) % MOD comb N, K = map(int, input().split()) map(int, input().split()) N ans = 0 0 ans inv = [0] * (MAX + 1) [0] * (MAX + 1) inv
N, K = map(int, input().split())

MAX = 4 * 10 ** 5 + 1
MOD = 10 ** 9 + 7

# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1

# Inverse
inv = [0] * (MAX + 1)
inv[1] = 1

# Inverse factorial
finv = [0] * (MAX + 1)
finv[0] = 1
finv[1] = 1

for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD


def comb(n, k):
    if n < k or k < 0:
        return 0
    return (fac[n] * finv[k] * finv[n - k]) % MOD


if N - 1 <= K:
    print(comb(2 * N - 1, N - 1))
else:
    # zero: 0 ~ K
    ans = 0
    for n in range(K + 1):
        ans += comb(N, n) * comb(N - 1, n)
        ans %= MOD
    print(ans)
