n, k = map(int, input().split())
mod = 10**9 + 7

list_size = 4*10**5 + 1
 
f_list = [1] * list_size
f_r_list = [1] * list_size
 
for i in range(list_size-1):
	f_list[i+1] = (f_list[i] * (i+1)) % mod
 
f_r_list[-1] = pow(f_list[-1], mod - 2, mod)
 
for i in range(list_size-2, -1, -1):
	f_r_list[i] = (f_r_list[i+1] * (i+1)) % mod
 
def comb(n, r, mod):
	if n < r or r < 0:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (f_list[n] * f_r_list[n-r] * f_r_list[r]) % mod


if k < n-1:
    ans = 0
    for i in range(k+1):
        ans += (comb(n-1, i, mod)*comb(n, i, mod))%mod
    print(ans%mod)
else:
    print((comb(2*n-1, n, mod))%mod) n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 list_size = 4*10**5 + 1 list_size 4*10**5 + 1 4*10**5 4 10**5 10 5 1 f_list = [1] * list_size f_list [1] * list_size [1] 1 list_size f_r_list = [1] * list_size f_r_list [1] * list_size [1] 1 list_size for i in range(list_size-1):
	f_list[i+1] = (f_list[i] * (i+1)) % mod
  i range(list_size-1) range list_size-1 list_size 1 f_list[i+1] = (f_list[i] * (i+1)) % mod f_list[i+1] f_list i+1 i 1 (f_list[i] * (i+1)) % mod f_list[i] * (i+1) f_list[i] f_list i i+1 i 1 mod f_r_list[-1] = pow(f_list[-1], mod - 2, mod) f_r_list[-1] f_r_list -1 pow(f_list[-1], mod - 2, mod) pow f_list[-1] f_list -1 mod - 2 mod 2 mod for i in range(list_size-2, -1, -1):
	f_r_list[i] = (f_r_list[i+1] * (i+1)) % mod
  i range(list_size-2, -1, -1) range list_size-2 list_size 2 -1 -1 f_r_list[i] = (f_r_list[i+1] * (i+1)) % mod f_r_list[i] f_r_list i (f_r_list[i+1] * (i+1)) % mod f_r_list[i+1] * (i+1) f_r_list[i+1] f_r_list i+1 i 1 i+1 i 1 mod def comb(n, r, mod):
	if n < r or r < 0:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (f_list[n] * f_r_list[n-r] * f_r_list[r]) % mod comb if n < r or r < 0:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (f_list[n] * f_r_list[n-r] * f_r_list[r]) % mod n < r or r < 0 n < r n r r < 0 r 0 return 0 0 elif n == 0 or r == 0 or n == r:
		return 1
	 n == 0 or r == 0 or n == r n == 0 or r == 0 n == 0 n 0 r == 0 r 0 n == r n r return 1 1 return (f_list[n] * f_r_list[n-r] * f_r_list[r]) % mod (f_list[n] * f_r_list[n-r] * f_r_list[r]) % mod f_list[n] * f_r_list[n-r] * f_r_list[r] f_list[n] * f_r_list[n-r] f_list[n] f_list n f_r_list[n-r] f_r_list n-r n r f_r_list[r] f_r_list r mod n n r r mod mod if k < n-1:
    ans = 0
    for i in range(k+1):
        ans += (comb(n-1, i, mod)*comb(n, i, mod))%mod
    print(ans%mod)
else:
    print((comb(2*n-1, n, mod))%mod) k < n-1 k n-1 n 1 ans = 0 ans 0 for i in range(k+1):
        ans += (comb(n-1, i, mod)*comb(n, i, mod))%mod
     i range(k+1) range k+1 k 1 ans += (comb(n-1, i, mod)*comb(n, i, mod))%mod ans (comb(n-1, i, mod)*comb(n, i, mod))%mod comb(n-1, i, mod)*comb(n, i, mod) comb(n-1, i, mod) comb n-1 n 1 i mod comb(n, i, mod) comb n i mod mod print(ans%mod) print ans%mod ans mod print((comb(2*n-1, n, mod))%mod) print (comb(2*n-1, n, mod))%mod comb(2*n-1, n, mod) comb 2*n-1 2*n 2 n 1 n mod mod f_list = [1] * list_size [1] * list_size f_list list_size = 4*10**5 + 1 4*10**5 + 1 list_size f_r_list = [1] * list_size [1] * list_size f_r_list ans += (comb(n-1, i, mod)*comb(n, i, mod))%mod (comb(n-1, i, mod)*comb(n, i, mod))%mod ans mod = 10**9 + 7 10**9 + 7 mod n, k = map(int, input().split()) map(int, input().split()) n ans = 0 0 ans k = map(int, input().split()) map(int, input().split()) k def comb(n, r, mod):
	if n < r or r < 0:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (f_list[n] * f_r_list[n-r] * f_r_list[r]) % mod def comb(n, r, mod):
	if n < r or r < 0:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (f_list[n] * f_r_list[n-r] * f_r_list[r]) % mod comb
n, k = map(int, input().split())
mod = 10**9 + 7

list_size = 4*10**5 + 1
 
f_list = [1] * list_size
f_r_list = [1] * list_size
 
for i in range(list_size-1):
	f_list[i+1] = (f_list[i] * (i+1)) % mod
 
f_r_list[-1] = pow(f_list[-1], mod - 2, mod)
 
for i in range(list_size-2, -1, -1):
	f_r_list[i] = (f_r_list[i+1] * (i+1)) % mod
 
def comb(n, r, mod):
	if n < r or r < 0:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (f_list[n] * f_r_list[n-r] * f_r_list[r]) % mod


if k < n-1:
    ans = 0
    for i in range(k+1):
        ans += (comb(n-1, i, mod)*comb(n, i, mod))%mod
    print(ans%mod)
else:
    print((comb(2*n-1, n, mod))%mod)