mod = 10 ** 9 + 7
n, k = map(int, input().split())
binomial = [1]
cum = 1
for i in range(1, n + 2):
    cum *= i
    cum = cum % mod
    binomial.append(cum)
inv = []
tmp = pow(cum, mod - 2, mod)
inv.append(tmp)
for j in range(n + 1, 0, -1):
    tmp = j * tmp % mod
    inv.append(tmp)
inv.reverse()

def comb(n, k):
    return binomial[n] * inv[n - k] % mod * inv[k] % mod if n >= k else 0
k = min(k, n - 1)
ans = 0
for m in range(k + 1):
        tmp = comb(n, m) * binomial[n - 1] * inv[n - 1 - m] * inv[m]
        ans += tmp % 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 binomial = [1] binomial [1] 1 cum = 1 cum 1 for i in range(1, n + 2):
    cum *= i
    cum = cum % mod
    binomial.append(cum) i range(1, n + 2) range 1 n + 2 n 2 cum *= i cum i cum = cum % mod cum cum % mod cum mod binomial.append(cum) binomial.append binomial append cum inv = [] inv [] tmp = pow(cum, mod - 2, mod) tmp pow(cum, mod - 2, mod) pow cum mod - 2 mod 2 mod inv.append(tmp) inv.append inv append tmp for j in range(n + 1, 0, -1):
    tmp = j * tmp % mod
    inv.append(tmp) j range(n + 1, 0, -1) range n + 1 n 1 0 -1 tmp = j * tmp % mod tmp j * tmp % mod j * tmp j tmp mod inv.append(tmp) inv.append inv append tmp inv.reverse() inv.reverse inv reverse def comb(n, k):
    return binomial[n] * inv[n - k] % mod * inv[k] % mod if n >= k else 0 comb return binomial[n] * inv[n - k] % mod * inv[k] % mod if n >= k else 0 binomial[n] * inv[n - k] % mod * inv[k] % mod if n >= k else 0 n >= k n k binomial[n] * inv[n - k] % mod * inv[k] % mod binomial[n] * inv[n - k] % mod * inv[k] binomial[n] * inv[n - k] % mod binomial[n] * inv[n - k] binomial[n] binomial n inv[n - k] inv n - k n k mod inv[k] inv k mod 0 n n k k k = min(k, n - 1) k min(k, n - 1) min k n - 1 n 1 ans = 0 ans 0 for m in range(k + 1):
        tmp = comb(n, m) * binomial[n - 1] * inv[n - 1 - m] * inv[m]
        ans += tmp % mod m range(k + 1) range k + 1 k 1 tmp = comb(n, m) * binomial[n - 1] * inv[n - 1 - m] * inv[m] tmp comb(n, m) * binomial[n - 1] * inv[n - 1 - m] * inv[m] comb(n, m) * binomial[n - 1] * inv[n - 1 - m] comb(n, m) * binomial[n - 1] comb(n, m) comb n m binomial[n - 1] binomial n - 1 n 1 inv[n - 1 - m] inv n - 1 - m n - 1 n 1 m inv[m] inv m ans += tmp % mod ans tmp % mod tmp mod ans %= mod ans mod print(ans) print ans def comb(n, k):
    return binomial[n] * inv[n - k] % mod * inv[k] % mod if n >= k else 0 def comb(n, k):
    return binomial[n] * inv[n - k] % mod * inv[k] % mod if n >= k else 0 comb n, k = map(int, input().split()) map(int, input().split()) n binomial = [1] [1] binomial cum = 1 1 cum cum *= i i cum inv = [] [] inv ans = 0 0 ans k = map(int, input().split()) map(int, input().split()) k mod = 10 ** 9 + 7 10 ** 9 + 7 mod tmp = j * tmp % mod j * tmp % mod tmp tmp = pow(cum, mod - 2, mod) pow(cum, mod - 2, mod) tmp k = min(k, n - 1) min(k, n - 1) k ans += tmp % mod tmp % mod ans ans %= mod mod ans tmp = comb(n, m) * binomial[n - 1] * inv[n - 1 - m] * inv[m] comb(n, m) * binomial[n - 1] * inv[n - 1 - m] * inv[m] tmp cum = cum % mod cum % mod cum
mod = 10 ** 9 + 7
n, k = map(int, input().split())
binomial = [1]
cum = 1
for i in range(1, n + 2):
    cum *= i
    cum = cum % mod
    binomial.append(cum)
inv = []
tmp = pow(cum, mod - 2, mod)
inv.append(tmp)
for j in range(n + 1, 0, -1):
    tmp = j * tmp % mod
    inv.append(tmp)
inv.reverse()

def comb(n, k):
    return binomial[n] * inv[n - k] % mod * inv[k] % mod if n >= k else 0
k = min(k, n - 1)
ans = 0
for m in range(k + 1):
        tmp = comb(n, m) * binomial[n - 1] * inv[n - 1 - m] * inv[m]
        ans += tmp % mod
ans %= mod
print(ans)