def modinv(a,m):
    return pow(a,m-2,m)

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

ans = 1
nCl = 1
n1Cl = 1
for l in range(1,min(k+1,n)):
    nCl = nCl*(n+1-l)*modinv(l,P)%P
    n1Cl = n1Cl*(n-l)*modinv(l,P)%P
    ans = (ans+nCl*n1Cl)%P

print(ans) def modinv(a,m):
    return pow(a,m-2,m) modinv return pow(a,m-2,m) pow(a,m-2,m) pow a m-2 m 2 m a a m m 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 ans = 1 ans 1 nCl = 1 nCl 1 n1Cl = 1 n1Cl 1 for l in range(1,min(k+1,n)):
    nCl = nCl*(n+1-l)*modinv(l,P)%P
    n1Cl = n1Cl*(n-l)*modinv(l,P)%P
    ans = (ans+nCl*n1Cl)%P l range(1,min(k+1,n)) range 1 min(k+1,n) min k+1 k 1 n nCl = nCl*(n+1-l)*modinv(l,P)%P nCl nCl*(n+1-l)*modinv(l,P)%P nCl*(n+1-l)*modinv(l,P) nCl*(n+1-l) nCl n+1-l n+1 n 1 l modinv(l,P) modinv l P P n1Cl = n1Cl*(n-l)*modinv(l,P)%P n1Cl n1Cl*(n-l)*modinv(l,P)%P n1Cl*(n-l)*modinv(l,P) n1Cl*(n-l) n1Cl n-l n l modinv(l,P) modinv l P P ans = (ans+nCl*n1Cl)%P ans (ans+nCl*n1Cl)%P ans+nCl*n1Cl ans nCl*n1Cl nCl n1Cl P print(ans) print ans n,k = map(int,input().split()) map(int,input().split()) n k = map(int,input().split()) map(int,input().split()) k P = 10**9+7 10**9+7 P def modinv(a,m):
    return pow(a,m-2,m) def modinv(a,m):
    return pow(a,m-2,m) modinv n1Cl = n1Cl*(n-l)*modinv(l,P)%P n1Cl*(n-l)*modinv(l,P)%P n1Cl nCl = nCl*(n+1-l)*modinv(l,P)%P nCl*(n+1-l)*modinv(l,P)%P nCl nCl = 1 1 nCl n1Cl = 1 1 n1Cl ans = 1 1 ans ans = (ans+nCl*n1Cl)%P (ans+nCl*n1Cl)%P ans
def modinv(a,m):
    return pow(a,m-2,m)

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

ans = 1
nCl = 1
n1Cl = 1
for l in range(1,min(k+1,n)):
    nCl = nCl*(n+1-l)*modinv(l,P)%P
    n1Cl = n1Cl*(n-l)*modinv(l,P)%P
    ans = (ans+nCl*n1Cl)%P

print(ans)
