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

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append(-inv[p % i] * (p // i) % p)
    factinv.append(factinv[-1] * inv[-1] % p)

def cmb(n, r, p):
    if n < r:
        return 0
    else:
        r = min(r, n - r)
        return((fact[n] * factinv[r] * factinv[n - r]) % p)

res = []
for i in range(n):
    res.append((cmb(n, i, p) * cmb(n - 1, i, p)) % p)

if n > k:
    print(sum(res[:k + 1]) % p)
else:
    print(sum(res) % p) n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k p = 10**9 + 7 p 10**9 + 7 10**9 10 9 7 fact = [1, 1] fact [1, 1] 1 1 factinv = [1, 1] factinv [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append(-inv[p % i] * (p // i) % p)
    factinv.append(factinv[-1] * inv[-1] % p) i range(2, n + 1) range 2 n + 1 n 1 fact.append((fact[-1] * i) % p) fact.append fact append (fact[-1] * i) % p fact[-1] * i fact[-1] fact -1 i p inv.append(-inv[p % i] * (p // i) % p) inv.append inv append -inv[p % i] * (p // i) % p -inv[p % i] * (p // i) -inv[p % i] inv[p % i] inv p % i p i p // i p i p factinv.append(factinv[-1] * inv[-1] % p) factinv.append factinv append factinv[-1] * inv[-1] % p factinv[-1] * inv[-1] factinv[-1] factinv -1 inv[-1] inv -1 p def cmb(n, r, p):
    if n < r:
        return 0
    else:
        r = min(r, n - r)
        return((fact[n] * factinv[r] * factinv[n - r]) % p) cmb if n < r:
        return 0
    else:
        r = min(r, n - r)
        return((fact[n] * factinv[r] * factinv[n - r]) % p) n < r n r return 0 0 r = min(r, n - r) r min(r, n - r) min r n - r n r return((fact[n] * factinv[r] * factinv[n - r]) % p) (fact[n] * factinv[r] * factinv[n - r]) % p fact[n] * factinv[r] * factinv[n - r] fact[n] * factinv[r] fact[n] fact n factinv[r] factinv r factinv[n - r] factinv n - r n r p n n r r p p res = [] res [] for i in range(n):
    res.append((cmb(n, i, p) * cmb(n - 1, i, p)) % p) i range(n) range n res.append((cmb(n, i, p) * cmb(n - 1, i, p)) % p) res.append res append (cmb(n, i, p) * cmb(n - 1, i, p)) % p cmb(n, i, p) * cmb(n - 1, i, p) cmb(n, i, p) cmb n i p cmb(n - 1, i, p) cmb n - 1 n 1 i p p if n > k:
    print(sum(res[:k + 1]) % p)
else:
    print(sum(res) % p) n > k n k print(sum(res[:k + 1]) % p) print sum(res[:k + 1]) % p sum(res[:k + 1]) sum res[:k + 1] res :k + 1 k + 1 k 1 p print(sum(res) % p) print sum(res) % p sum(res) sum res p p = 10**9 + 7 10**9 + 7 p factinv = [1, 1] [1, 1] factinv inv = [0, 1] [0, 1] inv res = [] [] res n, k = map(int, input().split()) map(int, input().split()) n k = map(int, input().split()) map(int, input().split()) k def cmb(n, r, p):
    if n < r:
        return 0
    else:
        r = min(r, n - r)
        return((fact[n] * factinv[r] * factinv[n - r]) % p) def cmb(n, r, p):
    if n < r:
        return 0
    else:
        r = min(r, n - r)
        return((fact[n] * factinv[r] * factinv[n - r]) % p) cmb fact = [1, 1] [1, 1] fact
n, k = map(int, input().split())
p = 10**9 + 7

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append(-inv[p % i] * (p // i) % p)
    factinv.append(factinv[-1] * inv[-1] % p)

def cmb(n, r, p):
    if n < r:
        return 0
    else:
        r = min(r, n - r)
        return((fact[n] * factinv[r] * factinv[n - r]) % p)

res = []
for i in range(n):
    res.append((cmb(n, i, p) * cmb(n - 1, i, p)) % p)

if n > k:
    print(sum(res[:k + 1]) % p)
else:
    print(sum(res) % p)
