MOD = 10**9 + 7

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

def getFacts(n, MOD):
    facts = [1] * (n+1)
    for x in range(2, n+1):
        facts[x] = (facts[x-1] * x) % MOD
    return facts
facts = getFacts(2*N, MOD)
def getInvFacts(n, MOD):
    invFacts = [0] * (n+1)
    invFacts[n] = pow(facts[n], MOD-2, MOD)
    for x in reversed(range(n)):
        invFacts[x] = (invFacts[x+1] * (x+1)) % MOD
    return invFacts
invFacts = getInvFacts(2*N, MOD)
def getComb(n, k, MOD):
    if n < k:
        return 0
    return facts[n] * invFacts[k] * invFacts[n-k] % MOD

ans = 0
for x in range(min(K, N-1)+1):
    ans += getComb(N, x, MOD) * getComb(N-1, x, MOD)
    ans %= MOD

print(ans) MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K def getFacts(n, MOD):
    facts = [1] * (n+1)
    for x in range(2, n+1):
        facts[x] = (facts[x-1] * x) % MOD
    return facts getFacts facts = [1] * (n+1) facts [1] * (n+1) [1] 1 n+1 n 1 for x in range(2, n+1):
        facts[x] = (facts[x-1] * x) % MOD
     x range(2, n+1) range 2 n+1 n 1 facts[x] = (facts[x-1] * x) % MOD facts[x] facts x (facts[x-1] * x) % MOD facts[x-1] * x facts[x-1] facts x-1 x 1 x MOD return facts facts n n MOD MOD facts = getFacts(2*N, MOD) facts getFacts(2*N, MOD) getFacts 2*N 2 N MOD def getInvFacts(n, MOD):
    invFacts = [0] * (n+1)
    invFacts[n] = pow(facts[n], MOD-2, MOD)
    for x in reversed(range(n)):
        invFacts[x] = (invFacts[x+1] * (x+1)) % MOD
    return invFacts getInvFacts invFacts = [0] * (n+1) invFacts [0] * (n+1) [0] 0 n+1 n 1 invFacts[n] = pow(facts[n], MOD-2, MOD) invFacts[n] invFacts n pow(facts[n], MOD-2, MOD) pow facts[n] facts n MOD-2 MOD 2 MOD for x in reversed(range(n)):
        invFacts[x] = (invFacts[x+1] * (x+1)) % MOD
     x reversed(range(n)) reversed range(n) range n invFacts[x] = (invFacts[x+1] * (x+1)) % MOD invFacts[x] invFacts x (invFacts[x+1] * (x+1)) % MOD invFacts[x+1] * (x+1) invFacts[x+1] invFacts x+1 x 1 x+1 x 1 MOD return invFacts invFacts n n MOD MOD invFacts = getInvFacts(2*N, MOD) invFacts getInvFacts(2*N, MOD) getInvFacts 2*N 2 N MOD def getComb(n, k, MOD):
    if n < k:
        return 0
    return facts[n] * invFacts[k] * invFacts[n-k] % MOD getComb if n < k:
        return 0
     n < k n k return 0 0 return facts[n] * invFacts[k] * invFacts[n-k] % MOD facts[n] * invFacts[k] * invFacts[n-k] % MOD facts[n] * invFacts[k] * invFacts[n-k] facts[n] * invFacts[k] facts[n] facts n invFacts[k] invFacts k invFacts[n-k] invFacts n-k n k MOD n n k k MOD MOD ans = 0 ans 0 for x in range(min(K, N-1)+1):
    ans += getComb(N, x, MOD) * getComb(N-1, x, MOD)
    ans %= MOD x range(min(K, N-1)+1) range min(K, N-1)+1 min(K, N-1) min K N-1 N 1 1 ans += getComb(N, x, MOD) * getComb(N-1, x, MOD) ans getComb(N, x, MOD) * getComb(N-1, x, MOD) getComb(N, x, MOD) getComb N x MOD getComb(N-1, x, MOD) getComb N-1 N 1 x MOD ans %= MOD ans MOD print(ans) print ans ans = 0 0 ans def getComb(n, k, MOD):
    if n < k:
        return 0
    return facts[n] * invFacts[k] * invFacts[n-k] % MOD def getComb(n, k, MOD):
    if n < k:
        return 0
    return facts[n] * invFacts[k] * invFacts[n-k] % MOD getComb N, K = map(int, input().split()) map(int, input().split()) N K = map(int, input().split()) map(int, input().split()) K facts = getFacts(2*N, MOD) getFacts(2*N, MOD) facts ans %= MOD MOD ans invFacts = getInvFacts(2*N, MOD) getInvFacts(2*N, MOD) invFacts ans += getComb(N, x, MOD) * getComb(N-1, x, MOD) getComb(N, x, MOD) * getComb(N-1, x, MOD) ans def getFacts(n, MOD):
    facts = [1] * (n+1)
    for x in range(2, n+1):
        facts[x] = (facts[x-1] * x) % MOD
    return facts def getFacts(n, MOD):
    facts = [1] * (n+1)
    for x in range(2, n+1):
        facts[x] = (facts[x-1] * x) % MOD
    return facts getFacts def getInvFacts(n, MOD):
    invFacts = [0] * (n+1)
    invFacts[n] = pow(facts[n], MOD-2, MOD)
    for x in reversed(range(n)):
        invFacts[x] = (invFacts[x+1] * (x+1)) % MOD
    return invFacts def getInvFacts(n, MOD):
    invFacts = [0] * (n+1)
    invFacts[n] = pow(facts[n], MOD-2, MOD)
    for x in reversed(range(n)):
        invFacts[x] = (invFacts[x+1] * (x+1)) % MOD
    return invFacts getInvFacts MOD = 10**9 + 7 10**9 + 7 MOD
MOD = 10**9 + 7

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

def getFacts(n, MOD):
    facts = [1] * (n+1)
    for x in range(2, n+1):
        facts[x] = (facts[x-1] * x) % MOD
    return facts
facts = getFacts(2*N, MOD)
def getInvFacts(n, MOD):
    invFacts = [0] * (n+1)
    invFacts[n] = pow(facts[n], MOD-2, MOD)
    for x in reversed(range(n)):
        invFacts[x] = (invFacts[x+1] * (x+1)) % MOD
    return invFacts
invFacts = getInvFacts(2*N, MOD)
def getComb(n, k, MOD):
    if n < k:
        return 0
    return facts[n] * invFacts[k] * invFacts[n-k] % MOD

ans = 0
for x in range(min(K, N-1)+1):
    ans += getComb(N, x, MOD) * getComb(N-1, x, MOD)
    ans %= MOD

print(ans)
