
nmax = 3*10**5
mod = 10**9+7

fac = [1]*nmax
finv = [1]*nmax
inv = [1]*nmax
def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod

def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod


ncr_pre()
n,k = map(int,input().split())
ans = 0
for i in range(min(n,k+1)):
    ans+=ncr(n,i)*ncr(i+n-i-1,i)
    ans%=mod
print(ans) nmax = 3*10**5 nmax 3*10**5 3 10**5 10 5 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 fac = [1]*nmax fac [1]*nmax [1] 1 nmax finv = [1]*nmax finv [1]*nmax [1] 1 nmax inv = [1]*nmax inv [1]*nmax [1] 1 nmax def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod ncr_pre for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod i range(2,nmax) range 2 nmax fac[i] = fac[i-1]*i % mod fac[i] fac i fac[i-1]*i % mod fac[i-1]*i fac[i-1] fac i-1 i 1 i mod inv[i] = mod - inv[mod%i] * (mod//i) %mod inv[i] inv i mod - inv[mod%i] * (mod//i) %mod mod inv[mod%i] * (mod//i) %mod inv[mod%i] * (mod//i) inv[mod%i] inv mod%i mod i mod//i mod i mod finv[i] = finv[i-1] * inv[i] %mod finv[i] finv i finv[i-1] * inv[i] %mod finv[i-1] * inv[i] finv[i-1] finv i-1 i 1 inv[i] inv i mod def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod ncr if n<r:
        return 0
     n<r n r return 0 0 if n<0 or r<0:
        return 0
     n<0 or r<0 n<0 n 0 r<0 r 0 return 0 0 return fac[n]* (finv[r] * finv[n-r] %mod) %mod fac[n]* (finv[r] * finv[n-r] %mod) %mod fac[n]* (finv[r] * finv[n-r] %mod) fac[n] fac n finv[r] * finv[n-r] %mod finv[r] * finv[n-r] finv[r] finv r finv[n-r] finv n-r n r mod mod n n r r ncr_pre() ncr_pre n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k ans = 0 ans 0 for i in range(min(n,k+1)):
    ans+=ncr(n,i)*ncr(i+n-i-1,i)
    ans%=mod i range(min(n,k+1)) range min(n,k+1) min n k+1 k 1 ans+=ncr(n,i)*ncr(i+n-i-1,i) ans ncr(n,i)*ncr(i+n-i-1,i) ncr(n,i) ncr n i ncr(i+n-i-1,i) ncr i+n-i-1 i+n-i i+n i n i 1 i ans%=mod ans mod print(ans) print ans def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod ncr_pre k = map(int,input().split()) map(int,input().split()) k finv = [1]*nmax [1]*nmax finv mod = 10**9+7 10**9+7 mod inv = [1]*nmax [1]*nmax inv fac = [1]*nmax [1]*nmax fac def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod ncr ans%=mod mod ans ans = 0 0 ans ans+=ncr(n,i)*ncr(i+n-i-1,i) ncr(n,i)*ncr(i+n-i-1,i) ans nmax = 3*10**5 3*10**5 nmax n,k = map(int,input().split()) map(int,input().split()) n

nmax = 3*10**5
mod = 10**9+7

fac = [1]*nmax
finv = [1]*nmax
inv = [1]*nmax
def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod

def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod


ncr_pre()
n,k = map(int,input().split())
ans = 0
for i in range(min(n,k+1)):
    ans+=ncr(n,i)*ncr(i+n-i-1,i)
    ans%=mod
print(ans)
