n, k = map(int, input().split())
MOD = 10**9+7

def prepare(n, MOD):
    facts = [1]*(n+1)
    for i in range(1, n+1):
        facts[i] = facts[i-1]*i%MOD
    invs = [1]*(n+1)
    _invs = [1]*(n+1)
    invs[n] = pow(facts[n], MOD-2, MOD)
    for i in range(0, n)[::-1]:
        invs[i] = invs[i+1] * (i+1) % MOD
    return facts, invs

ans = 0
facts, invs = prepare(n, MOD)

for i in range(1+min(n-1, k)):
    ans += facts[n]*invs[i]*invs[n-i]*facts[n-1]*invs[n-i-1]*invs[i]
    ans %= 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 def prepare(n, MOD):
    facts = [1]*(n+1)
    for i in range(1, n+1):
        facts[i] = facts[i-1]*i%MOD
    invs = [1]*(n+1)
    _invs = [1]*(n+1)
    invs[n] = pow(facts[n], MOD-2, MOD)
    for i in range(0, n)[::-1]:
        invs[i] = invs[i+1] * (i+1) % MOD
    return facts, invs prepare facts = [1]*(n+1) facts [1]*(n+1) [1] 1 n+1 n 1 for i in range(1, n+1):
        facts[i] = facts[i-1]*i%MOD
     i range(1, n+1) range 1 n+1 n 1 facts[i] = facts[i-1]*i%MOD facts[i] facts i facts[i-1]*i%MOD facts[i-1]*i facts[i-1] facts i-1 i 1 i MOD invs = [1]*(n+1) invs [1]*(n+1) [1] 1 n+1 n 1 _invs = [1]*(n+1) _invs [1]*(n+1) [1] 1 n+1 n 1 invs[n] = pow(facts[n], MOD-2, MOD) invs[n] invs n pow(facts[n], MOD-2, MOD) pow facts[n] facts n MOD-2 MOD 2 MOD for i in range(0, n)[::-1]:
        invs[i] = invs[i+1] * (i+1) % MOD
     i range(0, n)[::-1] (0, n) range 0 n ::-1 -1 invs[i] = invs[i+1] * (i+1) % MOD invs[i] invs i invs[i+1] * (i+1) % MOD invs[i+1] * (i+1) invs[i+1] invs i+1 i 1 i+1 i 1 MOD return facts, invs return facts, invs facts invs n n MOD MOD ans = 0 ans 0 facts, invs = prepare(n, MOD) facts prepare(n, MOD) prepare n MOD invs for i in range(1+min(n-1, k)):
    ans += facts[n]*invs[i]*invs[n-i]*facts[n-1]*invs[n-i-1]*invs[i]
    ans %= MOD i range(1+min(n-1, k)) range 1+min(n-1, k) 1 min(n-1, k) min n-1 n 1 k ans += facts[n]*invs[i]*invs[n-i]*facts[n-1]*invs[n-i-1]*invs[i] ans facts[n]*invs[i]*invs[n-i]*facts[n-1]*invs[n-i-1]*invs[i] facts[n]*invs[i]*invs[n-i]*facts[n-1]*invs[n-i-1] facts[n]*invs[i]*invs[n-i]*facts[n-1] facts[n]*invs[i]*invs[n-i] facts[n]*invs[i] facts[n] facts n invs[i] invs i invs[n-i] invs n-i n i facts[n-1] facts n-1 n 1 invs[n-i-1] invs n-i-1 n-i n i 1 invs[i] invs i ans %= MOD ans MOD print(ans) print ans ans += facts[n]*invs[i]*invs[n-i]*facts[n-1]*invs[n-i-1]*invs[i] facts[n]*invs[i]*invs[n-i]*facts[n-1]*invs[n-i-1]*invs[i] ans def prepare(n, MOD):
    facts = [1]*(n+1)
    for i in range(1, n+1):
        facts[i] = facts[i-1]*i%MOD
    invs = [1]*(n+1)
    _invs = [1]*(n+1)
    invs[n] = pow(facts[n], MOD-2, MOD)
    for i in range(0, n)[::-1]:
        invs[i] = invs[i+1] * (i+1) % MOD
    return facts, invs def prepare(n, MOD):
    facts = [1]*(n+1)
    for i in range(1, n+1):
        facts[i] = facts[i-1]*i%MOD
    invs = [1]*(n+1)
    _invs = [1]*(n+1)
    invs[n] = pow(facts[n], MOD-2, MOD)
    for i in range(0, n)[::-1]:
        invs[i] = invs[i+1] * (i+1) % MOD
    return facts, invs prepare facts, invs = prepare(n, MOD) prepare(n, MOD) facts MOD = 10**9+7 10**9+7 MOD ans = 0 0 ans invs = prepare(n, MOD) prepare(n, MOD) invs k = map(int, input().split()) map(int, input().split()) k ans %= MOD MOD ans n, k = map(int, input().split()) map(int, input().split()) n
n, k = map(int, input().split())
MOD = 10**9+7

def prepare(n, MOD):
    facts = [1]*(n+1)
    for i in range(1, n+1):
        facts[i] = facts[i-1]*i%MOD
    invs = [1]*(n+1)
    _invs = [1]*(n+1)
    invs[n] = pow(facts[n], MOD-2, MOD)
    for i in range(0, n)[::-1]:
        invs[i] = invs[i+1] * (i+1) % MOD
    return facts, invs

ans = 0
facts, invs = prepare(n, MOD)

for i in range(1+min(n-1, k)):
    ans += facts[n]*invs[i]*invs[n-i]*facts[n-1]*invs[n-i-1]*invs[i]
    ans %= MOD

print(ans)
