N, K = map(int, input().split())
K = min(N-1, K)
fact = [1 for _ in range(200001)]
inv = [1 for _ in range(200001)]
fact_inv = [1 for _ in range(200001)]
mod = 10**9+7
for i in range(2, 200001):
    fact[i] = (fact[i-1]*i) % mod
    inv[i] = mod - (inv[mod % i] * (mod // i)) % mod
    fact_inv[i] = (fact_inv[i-1] * inv[i]) % mod

dp = [0] * N
for i in range(N):
    f1 = (fact[N] * fact_inv[N-i] * fact_inv[i]) % mod  
    f2 = (fact[N-1] * fact_inv[N-i-1] * fact_inv[i]) % mod 
    f = (f1*f2)%mod
    if i == 0:
        dp[i] = f
    else:
        dp[i] = (dp[i-1] + f) % mod
print(dp[K]) N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K K = min(N-1, K) K min(N-1, K) min N-1 N 1 K 1 for _ in range(200001) for _ in range(200001) _ range(200001) range 200001 for _ in range(200001) 1 fact = [1 for _ in range(200001)] fact [1 for _ in range(200001)] 1 for _ in range(200001) for _ in range(200001) _ range(200001) range 200001 for _ in range(200001) 1 inv = [1 for _ in range(200001)] inv [1 for _ in range(200001)] 1 for _ in range(200001) for _ in range(200001) _ range(200001) range 200001 for _ in range(200001) 1 fact_inv = [1 for _ in range(200001)] fact_inv [1 for _ in range(200001)] mod = 10**9+7 mod 10**9+7 10**9 10 9 7 for i in range(2, 200001):
    fact[i] = (fact[i-1]*i) % mod
    inv[i] = mod - (inv[mod % i] * (mod // i)) % mod
    fact_inv[i] = (fact_inv[i-1] * inv[i]) % mod i range(2, 200001) range 2 200001 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] = 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 fact_inv[i] = (fact_inv[i-1] * inv[i]) % mod fact_inv[i] fact_inv i (fact_inv[i-1] * inv[i]) % mod fact_inv[i-1] * inv[i] fact_inv[i-1] fact_inv i-1 i 1 inv[i] inv i mod dp = [0] * N dp [0] * N [0] 0 N for i in range(N):
    f1 = (fact[N] * fact_inv[N-i] * fact_inv[i]) % mod  
    f2 = (fact[N-1] * fact_inv[N-i-1] * fact_inv[i]) % mod 
    f = (f1*f2)%mod
    if i == 0:
        dp[i] = f
    else:
        dp[i] = (dp[i-1] + f) % mod i range(N) range N f1 = (fact[N] * fact_inv[N-i] * fact_inv[i]) % mod f1 (fact[N] * fact_inv[N-i] * fact_inv[i]) % mod fact[N] * fact_inv[N-i] * fact_inv[i] fact[N] * fact_inv[N-i] fact[N] fact N fact_inv[N-i] fact_inv N-i N i fact_inv[i] fact_inv i mod f2 = (fact[N-1] * fact_inv[N-i-1] * fact_inv[i]) % mod f2 (fact[N-1] * fact_inv[N-i-1] * fact_inv[i]) % mod fact[N-1] * fact_inv[N-i-1] * fact_inv[i] fact[N-1] * fact_inv[N-i-1] fact[N-1] fact N-1 N 1 fact_inv[N-i-1] fact_inv N-i-1 N-i N i 1 fact_inv[i] fact_inv i mod f = (f1*f2)%mod f (f1*f2)%mod f1*f2 f1 f2 mod if i == 0:
        dp[i] = f
    else:
        dp[i] = (dp[i-1] + f) % mod i == 0 i 0 dp[i] = f dp[i] dp i f dp[i] = (dp[i-1] + f) % mod dp[i] dp i (dp[i-1] + f) % mod dp[i-1] + f dp[i-1] dp i-1 i 1 f mod print(dp[K]) print dp[K] dp K N, K = map(int, input().split()) map(int, input().split()) N inv = [1 for _ in range(200001)] [1 for _ in range(200001)] inv dp = [0] * N [0] * N dp K = min(N-1, K) min(N-1, K) K fact_inv = [1 for _ in range(200001)] [1 for _ in range(200001)] fact_inv mod = 10**9+7 10**9+7 mod f1 = (fact[N] * fact_inv[N-i] * fact_inv[i]) % mod (fact[N] * fact_inv[N-i] * fact_inv[i]) % mod f1 K = map(int, input().split()) map(int, input().split()) K f2 = (fact[N-1] * fact_inv[N-i-1] * fact_inv[i]) % mod (fact[N-1] * fact_inv[N-i-1] * fact_inv[i]) % mod f2 f = (f1*f2)%mod (f1*f2)%mod f fact = [1 for _ in range(200001)] [1 for _ in range(200001)] fact
N, K = map(int, input().split())
K = min(N-1, K)
fact = [1 for _ in range(200001)]
inv = [1 for _ in range(200001)]
fact_inv = [1 for _ in range(200001)]
mod = 10**9+7
for i in range(2, 200001):
    fact[i] = (fact[i-1]*i) % mod
    inv[i] = mod - (inv[mod % i] * (mod // i)) % mod
    fact_inv[i] = (fact_inv[i-1] * inv[i]) % mod

dp = [0] * N
for i in range(N):
    f1 = (fact[N] * fact_inv[N-i] * fact_inv[i]) % mod  
    f2 = (fact[N-1] * fact_inv[N-i-1] * fact_inv[i]) % mod 
    f = (f1*f2)%mod
    if i == 0:
        dp[i] = f
    else:
        dp[i] = (dp[i-1] + f) % mod
print(dp[K])