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

k = min(k,n-1)

mod=10**9+7

fact = [1]*(5*10**5+1)

for i in range(2,5*10**5+1):

  tmp = fact[i-1]*i

  tmp%=mod

  fact[i]=tmp

fact_inv = [0]*(5*10**5+1)

for i in range(5*10**5+1):

  fact_inv[i]=pow(fact[i],mod-2,mod)

  

ans=0

def comb(a,b):

  tmp = (fact[a]*fact_inv[a-b]%mod)*fact_inv[b]

  tmp%=mod

  return tmp





for i in range(k+1):

  tmp = comb(n,i)*comb(n-1,i)

  tmp%=mod

  ans+=tmp

  ans%=mod

  

print((ans%mod))
n,k = list(map(int,input().split()))

k = min(k,n-1)

mod=10**9+7

fact = [1]*(2*10**5+1)

for i in range(2,2*10**5+1):

  tmp = fact[i-1]*i

  tmp%=mod

  fact[i]=tmp

fact_inv = [0]*(2*10**5+1)

for i in range(2*10**5+1):

  fact_inv[i]=pow(fact[i],mod-2,mod)

  

ans=0

def comb(a,b):

  tmp = (fact[a]*fact_inv[a-b]%mod)*fact_inv[b]

  tmp%=mod

  return tmp





for i in range(k+1):

  tmp = comb(n,i)*comb(n-1,i)

  tmp%=mod

  ans+=tmp

  ans%=mod

  

print((ans%mod))
n, k = list(map(int, input().split()))
k = min(k, n - 1)
mod = 10**9 + 7
fact = [1] * (5 * 10**5 + 1)
for i in range(2, 5 * 10**5 + 1):
    tmp = fact[i - 1] * i
    tmp %= mod
    fact[i] = tmp
fact_inv = [0] * (5 * 10**5 + 1)
for i in range(5 * 10**5 + 1):
    fact_inv[i] = pow(fact[i], mod - 2, mod)
ans = 0


def comb(a, b):
    tmp = (fact[a] * fact_inv[a - b] % mod) * fact_inv[b]
    tmp %= mod
    return tmp


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

n, k = list(map(int, input().split()))
k = min(k, n - 1)
mod = 10**9 + 7
fact = [1] * (2 * 10**5 + 1)
for i in range(2, 2 * 10**5 + 1):
    tmp = fact[i - 1] * i
    tmp %= mod
    fact[i] = tmp
fact_inv = [0] * (2 * 10**5 + 1)
for i in range(2 * 10**5 + 1):
    fact_inv[i] = pow(fact[i], mod - 2, mod)
ans = 0


def comb(a, b):
    tmp = (fact[a] * fact_inv[a - b] % mod) * fact_inv[b]
    tmp %= mod
    return tmp


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

-fact = [1] * (5 * 10**5 + 1) -for i in range(2, 5 * 10**5 + 1): +fact = [1] * (2 * 10**5 + 1) +for i in range(2, 2 * 10**5 + 1): -fact_inv = [0] * (5 * 10**5 + 1) -for i in range(5 * 10**5 + 1): +fact_inv = [0] * (2 * 10**5 + 1) +for i in range(2 * 10**5 + 1):