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

fact = [0] * (N+1)
finv = [0] * len(fact)
inv  = [0] * len(fact)

fact[0] = fact[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, len(fact)):
    fact[i] = fact[i-1] * i % MOD
#    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    inv[i] = - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD

nCr = lambda n, r: fact[n] * finv[n-r] * finv[r] % MOD
nHr = lambda n, r: nCr(n+r-1, r)

# ans = 0
# for i in range(min(N-1, K) + 1):
#     ans += nCr(N, i) * nHr(N-i, i)
# ans = sum(nCr(N, i) * nHr(N-i, i) for i in range(min(N-1, K) + 1))
ans = sum(nCr(N, i) * nCr(N-1, i) for i in range(min(N-1, K) + 1))
print(ans % MOD) N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K MOD = 1000000007 MOD 1000000007 fact = [0] * (N+1) fact [0] * (N+1) [0] 0 N+1 N 1 finv = [0] * len(fact) finv [0] * len(fact) [0] 0 len(fact) len fact inv  = [0] * len(fact) inv [0] * len(fact) [0] 0 len(fact) len fact fact[0] = fact[1] = 1 fact[0] fact 0 1 = fact[1] = 1 fact[1] fact 1 1 finv[0] = finv[1] = 1 finv[0] finv 0 1 = finv[1] = 1 finv[1] finv 1 1 inv[1] = 1 inv[1] inv 1 1 for i in range(2, len(fact)):
    fact[i] = fact[i-1] * i % MOD
#    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    inv[i] = - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD i range(2, len(fact)) range 2 len(fact) len fact fact[i] = fact[i-1] * i % MOD fact[i] fact i fact[i-1] * i % MOD fact[i-1] * i fact[i-1] fact i-1 i 1 i MOD inv[i] = - inv[MOD % i] * (MOD // i) % MOD inv[i] inv i - inv[MOD % i] * (MOD // i) % MOD - inv[MOD % i] * (MOD // i) - inv[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 nCr = lambda n, r: fact[n] * finv[n-r] * finv[r] % MOD nCr lambda n, r: fact[n] * finv[n-r] * finv[r] % MOD fact[n] * finv[n-r] * finv[r] % MOD fact[n] * finv[n-r] * finv[r] fact[n] * finv[n-r] fact[n] fact n finv[n-r] finv n-r n r finv[r] finv r MOD n r nHr = lambda n, r: nCr(n+r-1, r) nHr lambda n, r: nCr(n+r-1, r) nCr(n+r-1, r) nCr n+r-1 n+r n r 1 r n r ans = sum(nCr(N, i) * nCr(N-1, i) for i in range(min(N-1, K) + 1)) ans sum(nCr(N, i) * nCr(N-1, i) for i in range(min(N-1, K) + 1)) sum nCr(N, i) * nCr(N-1, i) nCr(N, i) nCr N i nCr(N-1, i) nCr N-1 N 1 i print(ans % MOD) print ans % MOD ans MOD MOD = 1000000007 1000000007 MOD N, K = map(int, input().split()) map(int, input().split()) N finv = [0] * len(fact) [0] * len(fact) finv ans = sum(nCr(N, i) * nCr(N-1, i) for i in range(min(N-1, K) + 1)) sum(nCr(N, i) * nCr(N-1, i) for i in range(min(N-1, K) + 1)) ans nCr = lambda n, r: fact[n] * finv[n-r] * finv[r] % MOD lambda n, r: fact[n] * finv[n-r] * finv[r] % MOD nCr fact = [0] * (N+1) [0] * (N+1) fact nHr = lambda n, r: nCr(n+r-1, r) lambda n, r: nCr(n+r-1, r) nHr K = map(int, input().split()) map(int, input().split()) K inv  = [0] * len(fact) [0] * len(fact) inv
N, K = map(int, input().split())
MOD = 1000000007

fact = [0] * (N+1)
finv = [0] * len(fact)
inv  = [0] * len(fact)

fact[0] = fact[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, len(fact)):
    fact[i] = fact[i-1] * i % MOD
#    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    inv[i] = - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD

nCr = lambda n, r: fact[n] * finv[n-r] * finv[r] % MOD
nHr = lambda n, r: nCr(n+r-1, r)

# ans = 0
# for i in range(min(N-1, K) + 1):
#     ans += nCr(N, i) * nHr(N-i, i)
# ans = sum(nCr(N, i) * nHr(N-i, i) for i in range(min(N-1, K) + 1))
ans = sum(nCr(N, i) * nCr(N-1, i) for i in range(min(N-1, K) + 1))
print(ans % MOD)