n,k = [int(x) for x in input().split()]
mod = 10**9+7
MAX_N = 10**6
 
fact = [1]
fact_inv = [0]*(MAX_N+4)
for i in range(MAX_N+3):
    fact.append(fact[-1]*(i+1)%mod)

fact_inv[-1] = pow(fact[-1],mod-2,mod)
for i in range(MAX_N+2,-1,-1):
    fact_inv[i] = fact_inv[i+1]*(i+1)%mod
 
 
def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod
if k>=n:
  print(mod_comb_k(2*n-1,n,mod))
else:
  res=1
  for i in range(1,k+1):
    res = (res+mod_comb_k(n,i,mod)*mod_comb_k(n-1,n-i-1,mod))%mod
  print(res) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x n,k = [int(x) for x in input().split()] n [int(x) for x in input().split()] k mod = 10**9+7 mod 10**9+7 10**9 10 9 7 MAX_N = 10**6 MAX_N 10**6 10 6 fact = [1] fact [1] 1 fact_inv = [0]*(MAX_N+4) fact_inv [0]*(MAX_N+4) [0] 0 MAX_N+4 MAX_N 4 for i in range(MAX_N+3):
    fact.append(fact[-1]*(i+1)%mod) i range(MAX_N+3) range MAX_N+3 MAX_N 3 fact.append(fact[-1]*(i+1)%mod) fact.append fact append fact[-1]*(i+1)%mod fact[-1]*(i+1) fact[-1] fact -1 i+1 i 1 mod fact_inv[-1] = pow(fact[-1],mod-2,mod) fact_inv[-1] fact_inv -1 pow(fact[-1],mod-2,mod) pow fact[-1] fact -1 mod-2 mod 2 mod for i in range(MAX_N+2,-1,-1):
    fact_inv[i] = fact_inv[i+1]*(i+1)%mod
 
  i range(MAX_N+2,-1,-1) range MAX_N+2 MAX_N 2 -1 -1 fact_inv[i] = fact_inv[i+1]*(i+1)%mod fact_inv[i] fact_inv i fact_inv[i+1]*(i+1)%mod fact_inv[i+1]*(i+1) fact_inv[i+1] fact_inv i+1 i 1 i+1 i 1 mod def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod mod_comb_k return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod fact[n] * fact_inv[k] % mod * fact_inv[n-k] fact[n] * fact_inv[k] % mod fact[n] * fact_inv[k] fact[n] fact n fact_inv[k] fact_inv k mod fact_inv[n-k] fact_inv n-k n k mod n n k k mod mod if k>=n:
  print(mod_comb_k(2*n-1,n,mod))
else:
  res=1
  for i in range(1,k+1):
    res = (res+mod_comb_k(n,i,mod)*mod_comb_k(n-1,n-i-1,mod))%mod
  print(res) k>=n k n print(mod_comb_k(2*n-1,n,mod)) print mod_comb_k(2*n-1,n,mod) mod_comb_k 2*n-1 2*n 2 n 1 n mod res=1 res 1 for i in range(1,k+1):
    res = (res+mod_comb_k(n,i,mod)*mod_comb_k(n-1,n-i-1,mod))%mod
   i range(1,k+1) range 1 k+1 k 1 res = (res+mod_comb_k(n,i,mod)*mod_comb_k(n-1,n-i-1,mod))%mod res (res+mod_comb_k(n,i,mod)*mod_comb_k(n-1,n-i-1,mod))%mod res+mod_comb_k(n,i,mod)*mod_comb_k(n-1,n-i-1,mod) res mod_comb_k(n,i,mod)*mod_comb_k(n-1,n-i-1,mod) mod_comb_k(n,i,mod) mod_comb_k n i mod mod_comb_k(n-1,n-i-1,mod) mod_comb_k n-1 n 1 n-i-1 n-i n i 1 mod mod print(res) print res fact = [1] [1] fact k = [int(x) for x in input().split()] [int(x) for x in input().split()] k mod = 10**9+7 10**9+7 mod def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod mod_comb_k res = (res+mod_comb_k(n,i,mod)*mod_comb_k(n-1,n-i-1,mod))%mod (res+mod_comb_k(n,i,mod)*mod_comb_k(n-1,n-i-1,mod))%mod res MAX_N = 10**6 10**6 MAX_N res=1 1 res n,k = [int(x) for x in input().split()] [int(x) for x in input().split()] n fact_inv = [0]*(MAX_N+4) [0]*(MAX_N+4) fact_inv
n,k = [int(x) for x in input().split()]
mod = 10**9+7
MAX_N = 10**6
 
fact = [1]
fact_inv = [0]*(MAX_N+4)
for i in range(MAX_N+3):
    fact.append(fact[-1]*(i+1)%mod)

fact_inv[-1] = pow(fact[-1],mod-2,mod)
for i in range(MAX_N+2,-1,-1):
    fact_inv[i] = fact_inv[i+1]*(i+1)%mod
 
 
def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod
if k>=n:
  print(mod_comb_k(2*n-1,n,mod))
else:
  res=1
  for i in range(1,k+1):
    res = (res+mod_comb_k(n,i,mod)*mod_comb_k(n-1,n-i-1,mod))%mod
  print(res)