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

def prepare():
    fact = []
    f = 1
    for m in range(1, n):
        f *= m
        f %= mod
    fact.append(f)
    f *= n
    f %= mod
    fact.append(f)
    
    factinv = [1, 1]
    inv = [0, 1]

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

    return fact, factinv

def cmb(a, r, p):
    if (r < 0) or (n < r):
        return 0
    if a == 1:
        return f[a] * v[r] * v[n - r] % mod
    else:
        return f[a] * v[r] * v[n - r - 1] % mod

f,v = prepare()

ans = 1
for i in range(1, min(k + 1, n)):
    ans += cmb(0, i, mod) * cmb(1, i, 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 prepare():
    fact = []
    f = 1
    for m in range(1, n):
        f *= m
        f %= mod
    fact.append(f)
    f *= n
    f %= mod
    fact.append(f)
    
    factinv = [1, 1]
    inv = [0, 1]

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

    return fact, factinv prepare fact = [] fact [] f = 1 f 1 for m in range(1, n):
        f *= m
        f %= mod
     m range(1, n) range 1 n f *= m f m f %= mod f mod fact.append(f) fact.append fact append f f *= n f n f %= mod f mod fact.append(f) fact.append fact append f factinv = [1, 1] factinv [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, n + 1):
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)

     i range(2, n + 1) range 2 n + 1 n 1 inv.append((-inv[mod % i] * (mod // i)) % mod) inv.append inv append (-inv[mod % i] * (mod // i)) % mod -inv[mod % i] * (mod // i) -inv[mod % i] inv[mod % i] inv mod % i mod i mod // i mod i mod factinv.append((factinv[-1] * inv[-1]) % mod) factinv.append factinv append (factinv[-1] * inv[-1]) % mod factinv[-1] * inv[-1] factinv[-1] factinv -1 inv[-1] inv -1 mod return fact, factinv return fact, factinv fact factinv def cmb(a, r, p):
    if (r < 0) or (n < r):
        return 0
    if a == 1:
        return f[a] * v[r] * v[n - r] % mod
    else:
        return f[a] * v[r] * v[n - r - 1] % mod cmb if (r < 0) or (n < r):
        return 0
     (r < 0) or (n < r) r < 0 r 0 n < r n r return 0 0 if a == 1:
        return f[a] * v[r] * v[n - r] % mod
    else:
        return f[a] * v[r] * v[n - r - 1] % mod a == 1 a 1 return f[a] * v[r] * v[n - r] % mod f[a] * v[r] * v[n - r] % mod f[a] * v[r] * v[n - r] f[a] * v[r] f[a] f a v[r] v r v[n - r] v n - r n r mod return f[a] * v[r] * v[n - r - 1] % mod f[a] * v[r] * v[n - r - 1] % mod f[a] * v[r] * v[n - r - 1] f[a] * v[r] f[a] f a v[r] v r v[n - r - 1] v n - r - 1 n - r n r 1 mod a a r r p p f,v = prepare() f prepare() prepare v ans = 1 ans 1 for i in range(1, min(k + 1, n)):
    ans += cmb(0, i, mod) * cmb(1, i, mod)
    ans %= mod i range(1, min(k + 1, n)) range 1 min(k + 1, n) min k + 1 k 1 n ans += cmb(0, i, mod) * cmb(1, i, mod) ans cmb(0, i, mod) * cmb(1, i, mod) cmb(0, i, mod) cmb 0 i mod cmb(1, i, mod) cmb 1 i mod ans %= mod ans mod print(ans) print ans ans = 1 1 ans ans %= mod mod ans mod = 10**9+7 10**9+7 mod f,v = prepare() prepare() f k = map(int, input().split()) map(int, input().split()) k v = prepare() prepare() v def cmb(a, r, p):
    if (r < 0) or (n < r):
        return 0
    if a == 1:
        return f[a] * v[r] * v[n - r] % mod
    else:
        return f[a] * v[r] * v[n - r - 1] % mod def cmb(a, r, p):
    if (r < 0) or (n < r):
        return 0
    if a == 1:
        return f[a] * v[r] * v[n - r] % mod
    else:
        return f[a] * v[r] * v[n - r - 1] % mod cmb ans += cmb(0, i, mod) * cmb(1, i, mod) cmb(0, i, mod) * cmb(1, i, mod) ans def prepare():
    fact = []
    f = 1
    for m in range(1, n):
        f *= m
        f %= mod
    fact.append(f)
    f *= n
    f %= mod
    fact.append(f)
    
    factinv = [1, 1]
    inv = [0, 1]

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

    return fact, factinv def prepare():
    fact = []
    f = 1
    for m in range(1, n):
        f *= m
        f %= mod
    fact.append(f)
    f *= n
    f %= mod
    fact.append(f)
    
    factinv = [1, 1]
    inv = [0, 1]

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

    return fact, factinv prepare n,k = map(int, input().split()) map(int, input().split()) n
n,k = map(int, input().split())
mod = 10**9+7

def prepare():
    fact = []
    f = 1
    for m in range(1, n):
        f *= m
        f %= mod
    fact.append(f)
    f *= n
    f %= mod
    fact.append(f)
    
    factinv = [1, 1]
    inv = [0, 1]

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

    return fact, factinv

def cmb(a, r, p):
    if (r < 0) or (n < r):
        return 0
    if a == 1:
        return f[a] * v[r] * v[n - r] % mod
    else:
        return f[a] * v[r] * v[n - r - 1] % mod

f,v = prepare()

ans = 1
for i in range(1, min(k + 1, n)):
    ans += cmb(0, i, mod) * cmb(1, i, mod)
    ans %= mod

print(ans)
