n,k = map(int,input().split())

mod = 10**9 + 7
l = 10**7
fac = [1]*l
facr = [1]*l

for i in range(l-1):
    fac[i+1] = fac[i]*(i+1)%mod
facr[l-1] = pow(fac[l-1],mod - 2,mod)
for i in range(1,l)[::-1]:
    facr[i-1] = facr[i]*i%mod

def combi(N,K):
    return fac[N]*facr[N-K]%mod*facr[K]%mod

ans = 1
for i in range(1,min(n,k+1)):
    ans += combi(n,i)*combi(n-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 l = 10**7 l 10**7 10 7 fac = [1]*l fac [1]*l [1] 1 l facr = [1]*l facr [1]*l [1] 1 l for i in range(l-1):
    fac[i+1] = fac[i]*(i+1)%mod i range(l-1) range l-1 l 1 fac[i+1] = fac[i]*(i+1)%mod fac[i+1] fac i+1 i 1 fac[i]*(i+1)%mod fac[i]*(i+1) fac[i] fac i i+1 i 1 mod facr[l-1] = pow(fac[l-1],mod - 2,mod) facr[l-1] facr l-1 l 1 pow(fac[l-1],mod - 2,mod) pow fac[l-1] fac l-1 l 1 mod - 2 mod 2 mod for i in range(1,l)[::-1]:
    facr[i-1] = facr[i]*i%mod i range(1,l)[::-1] (1,l) range 1 l ::-1 -1 facr[i-1] = facr[i]*i%mod facr[i-1] facr i-1 i 1 facr[i]*i%mod facr[i]*i facr[i] facr i i mod def combi(N,K):
    return fac[N]*facr[N-K]%mod*facr[K]%mod combi return fac[N]*facr[N-K]%mod*facr[K]%mod fac[N]*facr[N-K]%mod*facr[K]%mod fac[N]*facr[N-K]%mod*facr[K] fac[N]*facr[N-K]%mod fac[N]*facr[N-K] fac[N] fac N facr[N-K] facr N-K N K mod facr[K] facr K mod N N K K ans = 1 ans 1 for i in range(1,min(n,k+1)):
    ans += combi(n,i)*combi(n-1,i)%mod
    ans %= mod i range(1,min(n,k+1)) range 1 min(n,k+1) min n k+1 k 1 ans += combi(n,i)*combi(n-1,i)%mod ans combi(n,i)*combi(n-1,i)%mod combi(n,i)*combi(n-1,i) combi(n,i) combi n i combi(n-1,i) combi n-1 n 1 i mod ans %= mod ans mod print(ans) print ans k = map(int,input().split()) map(int,input().split()) k ans += combi(n,i)*combi(n-1,i)%mod combi(n,i)*combi(n-1,i)%mod ans ans = 1 1 ans l = 10**7 10**7 l fac = [1]*l [1]*l fac n,k = map(int,input().split()) map(int,input().split()) n facr = [1]*l [1]*l facr ans %= mod mod ans mod = 10**9 + 7 10**9 + 7 mod def combi(N,K):
    return fac[N]*facr[N-K]%mod*facr[K]%mod def combi(N,K):
    return fac[N]*facr[N-K]%mod*facr[K]%mod combi
n,k = map(int,input().split())

mod = 10**9 + 7
l = 10**7
fac = [1]*l
facr = [1]*l

for i in range(l-1):
    fac[i+1] = fac[i]*(i+1)%mod
facr[l-1] = pow(fac[l-1],mod - 2,mod)
for i in range(1,l)[::-1]:
    facr[i-1] = facr[i]*i%mod

def combi(N,K):
    return fac[N]*facr[N-K]%mod*facr[K]%mod

ans = 1
for i in range(1,min(n,k+1)):
    ans += combi(n,i)*combi(n-1,i)%mod
    ans %= mod
print(ans)
