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

#output
mod = pow(10, 9) + 7

n_ = 4*10**5 + 5
fun = [1]*(n_+1)
for i in range(1,n_+1):
    fun[i] = fun[i-1]*i%mod
rev = [1]*(n_+1)
rev[n_] = pow(fun[n_],mod-2,mod)
for i in range(n_-1,0,-1):
    rev[i] = rev[i+1]*(i+1)%mod
def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod

if n <= k-1:
    print(cmb(2*n-1, n))
else:
    answer = 0
    for m in range(k+1):
        answer += cmb(n, m)*cmb(n-1, m) % mod
        answer %= mod
    print(answer) n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k mod = pow(10, 9) + 7 mod pow(10, 9) + 7 pow(10, 9) pow 10 9 7 n_ = 4*10**5 + 5 n_ 4*10**5 + 5 4*10**5 4 10**5 10 5 5 fun = [1]*(n_+1) fun [1]*(n_+1) [1] 1 n_+1 n_ 1 for i in range(1,n_+1):
    fun[i] = fun[i-1]*i%mod i range(1,n_+1) range 1 n_+1 n_ 1 fun[i] = fun[i-1]*i%mod fun[i] fun i fun[i-1]*i%mod fun[i-1]*i fun[i-1] fun i-1 i 1 i mod rev = [1]*(n_+1) rev [1]*(n_+1) [1] 1 n_+1 n_ 1 rev[n_] = pow(fun[n_],mod-2,mod) rev[n_] rev n_ pow(fun[n_],mod-2,mod) pow fun[n_] fun n_ mod-2 mod 2 mod for i in range(n_-1,0,-1):
    rev[i] = rev[i+1]*(i+1)%mod i range(n_-1,0,-1) range n_-1 n_ 1 0 -1 rev[i] = rev[i+1]*(i+1)%mod rev[i] rev i rev[i+1]*(i+1)%mod rev[i+1]*(i+1) rev[i+1] rev i+1 i 1 i+1 i 1 mod def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod cmb if n <= 0 or r < 0 or r > n: return 0
     n <= 0 or r < 0 or r > n n <= 0 or r < 0 n <= 0 n 0 r < 0 r 0 r > n r n return fun[n]*rev[r]%mod*rev[n-r]%mod fun[n]*rev[r]%mod*rev[n-r]%mod fun[n]*rev[r]%mod*rev[n-r] fun[n]*rev[r]%mod fun[n]*rev[r] fun[n] fun n rev[r] rev r mod rev[n-r] rev n-r n r mod n n r r if n <= k-1:
    print(cmb(2*n-1, n))
else:
    answer = 0
    for m in range(k+1):
        answer += cmb(n, m)*cmb(n-1, m) % mod
        answer %= mod
    print(answer) n <= k-1 n k-1 k 1 print(cmb(2*n-1, n)) print cmb(2*n-1, n) cmb 2*n-1 2*n 2 n 1 n answer = 0 answer 0 for m in range(k+1):
        answer += cmb(n, m)*cmb(n-1, m) % mod
        answer %= mod
     m range(k+1) range k+1 k 1 answer += cmb(n, m)*cmb(n-1, m) % mod answer cmb(n, m)*cmb(n-1, m) % mod cmb(n, m)*cmb(n-1, m) cmb(n, m) cmb n m cmb(n-1, m) cmb n-1 n 1 m mod answer %= mod answer mod print(answer) print answer fun = [1]*(n_+1) [1]*(n_+1) fun n, k = map(int, input().split()) map(int, input().split()) n n_ = 4*10**5 + 5 4*10**5 + 5 n_ def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod cmb answer += cmb(n, m)*cmb(n-1, m) % mod cmb(n, m)*cmb(n-1, m) % mod answer k = map(int, input().split()) map(int, input().split()) k mod = pow(10, 9) + 7 pow(10, 9) + 7 mod answer = 0 0 answer rev = [1]*(n_+1) [1]*(n_+1) rev answer %= mod mod answer
#input
n, k = map(int, input().split())

#output
mod = pow(10, 9) + 7

n_ = 4*10**5 + 5
fun = [1]*(n_+1)
for i in range(1,n_+1):
    fun[i] = fun[i-1]*i%mod
rev = [1]*(n_+1)
rev[n_] = pow(fun[n_],mod-2,mod)
for i in range(n_-1,0,-1):
    rev[i] = rev[i+1]*(i+1)%mod
def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod

if n <= k-1:
    print(cmb(2*n-1, n))
else:
    answer = 0
    for m in range(k+1):
        answer += cmb(n, m)*cmb(n-1, m) % mod
        answer %= mod
    print(answer)