n, k = map(int, input().split())
mod = 10**9 + 7
def setFact(n, mod):
    global fact
    fact = [1]
    global ifact
    ifact = [1] * (n+1)
    for i in range(1, n+1):
        fact.append(fact[i-1]*i%mod)
    ifact[-1] = pow(fact[-1], mod-2, mod)
    for i in range(2, n+2):
        ifact[-i] = ifact[-i+1]*(n-i+2) %mod
def combination(n, k , mod):
    global fact
    global ifact
    if k < 0 or k > n:
        return 0
    else:
        return fact[n] * ifact[n-k] * ifact[k] % mod
setFact(n, mod)
ans = 0
for i in range(min(n+1, k+1)):
    ans += combination(n,i,mod) *combination(n-1,i, mod) %mod
    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 setFact(n, mod):
    global fact
    fact = [1]
    global ifact
    ifact = [1] * (n+1)
    for i in range(1, n+1):
        fact.append(fact[i-1]*i%mod)
    ifact[-1] = pow(fact[-1], mod-2, mod)
    for i in range(2, n+2):
        ifact[-i] = ifact[-i+1]*(n-i+2) %mod setFact global fact fact = [1] fact [1] 1 global ifact ifact = [1] * (n+1) ifact [1] * (n+1) [1] 1 n+1 n 1 for i in range(1, n+1):
        fact.append(fact[i-1]*i%mod)
     i range(1, n+1) range 1 n+1 n 1 fact.append(fact[i-1]*i%mod) fact.append fact append fact[i-1]*i%mod fact[i-1]*i fact[i-1] fact i-1 i 1 i mod ifact[-1] = pow(fact[-1], mod-2, mod) ifact[-1] ifact -1 pow(fact[-1], mod-2, mod) pow fact[-1] fact -1 mod-2 mod 2 mod for i in range(2, n+2):
        ifact[-i] = ifact[-i+1]*(n-i+2) %mod i range(2, n+2) range 2 n+2 n 2 ifact[-i] = ifact[-i+1]*(n-i+2) %mod ifact[-i] ifact -i i ifact[-i+1]*(n-i+2) %mod ifact[-i+1]*(n-i+2) ifact[-i+1] ifact -i+1 -i i 1 n-i+2 n-i n i 2 mod n n mod mod def combination(n, k , mod):
    global fact
    global ifact
    if k < 0 or k > n:
        return 0
    else:
        return fact[n] * ifact[n-k] * ifact[k] % mod combination global fact global ifact if k < 0 or k > n:
        return 0
    else:
        return fact[n] * ifact[n-k] * ifact[k] % mod k < 0 or k > n k < 0 k 0 k > n k n return 0 0 return fact[n] * ifact[n-k] * ifact[k] % mod fact[n] * ifact[n-k] * ifact[k] % mod fact[n] * ifact[n-k] * ifact[k] fact[n] * ifact[n-k] fact[n] fact n ifact[n-k] ifact n-k n k ifact[k] ifact k mod n n k k mod mod setFact(n, mod) setFact n mod ans = 0 ans 0 for i in range(min(n+1, k+1)):
    ans += combination(n,i,mod) *combination(n-1,i, mod) %mod
    ans %= mod i range(min(n+1, k+1)) range min(n+1, k+1) min n+1 n 1 k+1 k 1 ans += combination(n,i,mod) *combination(n-1,i, mod) %mod ans combination(n,i,mod) *combination(n-1,i, mod) %mod combination(n,i,mod) *combination(n-1,i, mod) combination(n,i,mod) combination n i mod combination(n-1,i, mod) combination n-1 n 1 i mod mod ans %= mod ans mod print(ans) print ans ans = 0 0 ans mod = 10**9 + 7 10**9 + 7 mod ans += combination(n,i,mod) *combination(n-1,i, mod) %mod combination(n,i,mod) *combination(n-1,i, mod) %mod ans k = map(int, input().split()) map(int, input().split()) k def combination(n, k , mod):
    global fact
    global ifact
    if k < 0 or k > n:
        return 0
    else:
        return fact[n] * ifact[n-k] * ifact[k] % mod def combination(n, k , mod):
    global fact
    global ifact
    if k < 0 or k > n:
        return 0
    else:
        return fact[n] * ifact[n-k] * ifact[k] % mod combination n, k = map(int, input().split()) map(int, input().split()) n def setFact(n, mod):
    global fact
    fact = [1]
    global ifact
    ifact = [1] * (n+1)
    for i in range(1, n+1):
        fact.append(fact[i-1]*i%mod)
    ifact[-1] = pow(fact[-1], mod-2, mod)
    for i in range(2, n+2):
        ifact[-i] = ifact[-i+1]*(n-i+2) %mod def setFact(n, mod):
    global fact
    fact = [1]
    global ifact
    ifact = [1] * (n+1)
    for i in range(1, n+1):
        fact.append(fact[i-1]*i%mod)
    ifact[-1] = pow(fact[-1], mod-2, mod)
    for i in range(2, n+2):
        ifact[-i] = ifact[-i+1]*(n-i+2) %mod setFact ans %= mod mod ans
n, k = map(int, input().split())
mod = 10**9 + 7
def setFact(n, mod):
    global fact
    fact = [1]
    global ifact
    ifact = [1] * (n+1)
    for i in range(1, n+1):
        fact.append(fact[i-1]*i%mod)
    ifact[-1] = pow(fact[-1], mod-2, mod)
    for i in range(2, n+2):
        ifact[-i] = ifact[-i+1]*(n-i+2) %mod
def combination(n, k , mod):
    global fact
    global ifact
    if k < 0 or k > n:
        return 0
    else:
        return fact[n] * ifact[n-k] * ifact[k] % mod
setFact(n, mod)
ans = 0
for i in range(min(n+1, k+1)):
    ans += combination(n,i,mod) *combination(n-1,i, mod) %mod
    ans %= mod
print(ans)