x=input().split()
n=int(x[0])
k=int(x[1])
def fact_inverse(n,p):
    fact=[1]*(n+1)
    inv=[1]*(n+1)
    inv_fact=[1]*(n+1)
    inv[0]=0
    inv_fact[0]=0
    for i in range(2,n+1):
        fact[i]=(fact[i-1]*i)%p
        #compute the inverse of i mod p
        inv[i]=(-inv[p%i]*(p//i))%p
        inv_fact[i]=(inv_fact[i-1]*inv[i])%p
    return fact,inv_fact    
    

def combi2(n,p):
    f,inv=fact_inverse(n,p)
    combis=[1]*(n+1)
    for k in range(1,n+1):
        if k >=n//2+1:
            combis[k]=combis[n-k]
        else:
            combis[k]=(((f[n]*inv[n-k])%p)*inv[k])%p
    return combis    
      
    
p=10**9+7
combis1=combi2(n,p)
combis2=combi2(n-1,p)
s=0
L=min(n,k+1)
for i in range(L):
  s=(s+(combis1[i]*combis2[i])%p)%p
print(s)   x=input().split() x input().split() ().split () input split n=int(x[0]) n int(x[0]) int x[0] x 0 k=int(x[1]) k int(x[1]) int x[1] x 1 def fact_inverse(n,p):
    fact=[1]*(n+1)
    inv=[1]*(n+1)
    inv_fact=[1]*(n+1)
    inv[0]=0
    inv_fact[0]=0
    for i in range(2,n+1):
        fact[i]=(fact[i-1]*i)%p
        #compute the inverse of i mod p
        inv[i]=(-inv[p%i]*(p//i))%p
        inv_fact[i]=(inv_fact[i-1]*inv[i])%p
    return fact,inv_fact    
     fact_inverse fact=[1]*(n+1) fact [1]*(n+1) [1] 1 n+1 n 1 inv=[1]*(n+1) inv [1]*(n+1) [1] 1 n+1 n 1 inv_fact=[1]*(n+1) inv_fact [1]*(n+1) [1] 1 n+1 n 1 inv[0]=0 inv[0] inv 0 0 inv_fact[0]=0 inv_fact[0] inv_fact 0 0 for i in range(2,n+1):
        fact[i]=(fact[i-1]*i)%p
        #compute the inverse of i mod p
        inv[i]=(-inv[p%i]*(p//i))%p
        inv_fact[i]=(inv_fact[i-1]*inv[i])%p
     i range(2,n+1) range 2 n+1 n 1 fact[i]=(fact[i-1]*i)%p fact[i] fact i (fact[i-1]*i)%p fact[i-1]*i fact[i-1] fact i-1 i 1 i p inv[i]=(-inv[p%i]*(p//i))%p inv[i] inv i (-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 inv_fact[i]=(inv_fact[i-1]*inv[i])%p inv_fact[i] inv_fact i (inv_fact[i-1]*inv[i])%p inv_fact[i-1]*inv[i] inv_fact[i-1] inv_fact i-1 i 1 inv[i] inv i p return fact,inv_fact return fact,inv_fact fact inv_fact n n p p def combi2(n,p):
    f,inv=fact_inverse(n,p)
    combis=[1]*(n+1)
    for k in range(1,n+1):
        if k >=n//2+1:
            combis[k]=combis[n-k]
        else:
            combis[k]=(((f[n]*inv[n-k])%p)*inv[k])%p
    return combis    
      
     combi2 f,inv=fact_inverse(n,p) f fact_inverse(n,p) fact_inverse n p inv combis=[1]*(n+1) combis [1]*(n+1) [1] 1 n+1 n 1 for k in range(1,n+1):
        if k >=n//2+1:
            combis[k]=combis[n-k]
        else:
            combis[k]=(((f[n]*inv[n-k])%p)*inv[k])%p
     k range(1,n+1) range 1 n+1 n 1 if k >=n//2+1:
            combis[k]=combis[n-k]
        else:
            combis[k]=(((f[n]*inv[n-k])%p)*inv[k])%p
     k >=n//2+1 k n//2+1 n//2 n 2 1 combis[k]=combis[n-k] combis[k] combis k combis[n-k] combis n-k n k combis[k]=(((f[n]*inv[n-k])%p)*inv[k])%p combis[k] combis k (((f[n]*inv[n-k])%p)*inv[k])%p ((f[n]*inv[n-k])%p)*inv[k] (f[n]*inv[n-k])%p f[n]*inv[n-k] f[n] f n inv[n-k] inv n-k n k p inv[k] inv k p return combis combis n n p p p=10**9+7 p 10**9+7 10**9 10 9 7 combis1=combi2(n,p) combis1 combi2(n,p) combi2 n p combis2=combi2(n-1,p) combis2 combi2(n-1,p) combi2 n-1 n 1 p s=0 s 0 L=min(n,k+1) L min(n,k+1) min n k+1 k 1 for i in range(L):
  s=(s+(combis1[i]*combis2[i])%p)%p i range(L) range L s=(s+(combis1[i]*combis2[i])%p)%p s (s+(combis1[i]*combis2[i])%p)%p s+(combis1[i]*combis2[i])%p s (combis1[i]*combis2[i])%p combis1[i]*combis2[i] combis1[i] combis1 i combis2[i] combis2 i p p print(s) print s def combi2(n,p):
    f,inv=fact_inverse(n,p)
    combis=[1]*(n+1)
    for k in range(1,n+1):
        if k >=n//2+1:
            combis[k]=combis[n-k]
        else:
            combis[k]=(((f[n]*inv[n-k])%p)*inv[k])%p
    return combis    
      
     def combi2(n,p):
    f,inv=fact_inverse(n,p)
    combis=[1]*(n+1)
    for k in range(1,n+1):
        if k >=n//2+1:
            combis[k]=combis[n-k]
        else:
            combis[k]=(((f[n]*inv[n-k])%p)*inv[k])%p
    return combis    
      
     combi2 p=10**9+7 10**9+7 p n=int(x[0]) int(x[0]) n def fact_inverse(n,p):
    fact=[1]*(n+1)
    inv=[1]*(n+1)
    inv_fact=[1]*(n+1)
    inv[0]=0
    inv_fact[0]=0
    for i in range(2,n+1):
        fact[i]=(fact[i-1]*i)%p
        #compute the inverse of i mod p
        inv[i]=(-inv[p%i]*(p//i))%p
        inv_fact[i]=(inv_fact[i-1]*inv[i])%p
    return fact,inv_fact    
     def fact_inverse(n,p):
    fact=[1]*(n+1)
    inv=[1]*(n+1)
    inv_fact=[1]*(n+1)
    inv[0]=0
    inv_fact[0]=0
    for i in range(2,n+1):
        fact[i]=(fact[i-1]*i)%p
        #compute the inverse of i mod p
        inv[i]=(-inv[p%i]*(p//i))%p
        inv_fact[i]=(inv_fact[i-1]*inv[i])%p
    return fact,inv_fact    
     fact_inverse x=input().split() input().split() x s=(s+(combis1[i]*combis2[i])%p)%p (s+(combis1[i]*combis2[i])%p)%p s s=0 0 s L=min(n,k+1) min(n,k+1) L combis1=combi2(n,p) combi2(n,p) combis1 combis2=combi2(n-1,p) combi2(n-1,p) combis2 k=int(x[1]) int(x[1]) k
x=input().split()
n=int(x[0])
k=int(x[1])
def fact_inverse(n,p):
    fact=[1]*(n+1)
    inv=[1]*(n+1)
    inv_fact=[1]*(n+1)
    inv[0]=0
    inv_fact[0]=0
    for i in range(2,n+1):
        fact[i]=(fact[i-1]*i)%p
        #compute the inverse of i mod p
        inv[i]=(-inv[p%i]*(p//i))%p
        inv_fact[i]=(inv_fact[i-1]*inv[i])%p
    return fact,inv_fact    
    

def combi2(n,p):
    f,inv=fact_inverse(n,p)
    combis=[1]*(n+1)
    for k in range(1,n+1):
        if k >=n//2+1:
            combis[k]=combis[n-k]
        else:
            combis[k]=(((f[n]*inv[n-k])%p)*inv[k])%p
    return combis    
      
    
p=10**9+7
combis1=combi2(n,p)
combis2=combi2(n-1,p)
s=0
L=min(n,k+1)
for i in range(L):
  s=(s+(combis1[i]*combis2[i])%p)%p
print(s)  
