def cmb(n, r, mod):
	if (r < 0) or (n < r):
		return 0
	r = min(r, n-r)
	return fact[n]*factinv[r]*factinv[n-r]%mod


mod = 10**9+7
N = 10**6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N+1):
	fact.append((fact[-1]*i)%mod)
	inv.append((-inv[mod%i]*(mod//i))%mod)
	factinv.append((factinv[-1]*inv[-1])%mod)

n, k = map(int,input().split())
ans = 0

for i in range(0, min(n, k+1)):
	#0がi個
	ans = (ans + cmb(n, i, mod) * cmb(n-1, i, mod)) % mod
print(ans) def cmb(n, r, mod):
	if (r < 0) or (n < r):
		return 0
	r = min(r, n-r)
	return fact[n]*factinv[r]*factinv[n-r]%mod cmb if (r < 0) or (n < r):
		return 0
	 (r < 0) or (n < r) r < 0 r 0 n < r n r return 0 0 r = min(r, n-r) r min(r, n-r) min r n-r n r return fact[n]*factinv[r]*factinv[n-r]%mod fact[n]*factinv[r]*factinv[n-r]%mod fact[n]*factinv[r]*factinv[n-r] fact[n]*factinv[r] fact[n] fact n factinv[r] factinv r factinv[n-r] factinv n-r n r mod n n r r mod mod mod = 10**9+7 mod 10**9+7 10**9 10 9 7 N = 10**6 N 10**6 10 6 fact = [1, 1] fact [1, 1] 1 1 factinv = [1, 1] factinv [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, N+1):
	fact.append((fact[-1]*i)%mod)
	inv.append((-inv[mod%i]*(mod//i))%mod)
	factinv.append((factinv[-1]*inv[-1])%mod) i range(2, N+1) range 2 N+1 N 1 fact.append((fact[-1]*i)%mod) fact.append fact append (fact[-1]*i)%mod fact[-1]*i fact[-1] fact -1 i mod inv.append((-inv[mod%i]*(mod//i))%mod) inv.append inv append (-inv[mod%i]*(mod//i))%mod -inv[mod%i]*(mod//i) -inv[mod%i] inv[mod%i] inv mod%i mod i mod//i mod i mod factinv.append((factinv[-1]*inv[-1])%mod) factinv.append factinv append (factinv[-1]*inv[-1])%mod factinv[-1]*inv[-1] factinv[-1] factinv -1 inv[-1] inv -1 mod n, k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k ans = 0 ans 0 for i in range(0, min(n, k+1)):
	#0がi個
	ans = (ans + cmb(n, i, mod) * cmb(n-1, i, mod)) % mod i range(0, min(n, k+1)) range 0 min(n, k+1) min n k+1 k 1 ans = (ans + cmb(n, i, mod) * cmb(n-1, i, mod)) % mod ans (ans + cmb(n, i, mod) * cmb(n-1, i, mod)) % mod ans + cmb(n, i, mod) * cmb(n-1, i, mod) ans cmb(n, i, mod) * cmb(n-1, i, mod) cmb(n, i, mod) cmb n i mod cmb(n-1, i, mod) cmb n-1 n 1 i mod mod print(ans) print ans mod = 10**9+7 10**9+7 mod def cmb(n, r, mod):
	if (r < 0) or (n < r):
		return 0
	r = min(r, n-r)
	return fact[n]*factinv[r]*factinv[n-r]%mod def cmb(n, r, mod):
	if (r < 0) or (n < r):
		return 0
	r = min(r, n-r)
	return fact[n]*factinv[r]*factinv[n-r]%mod cmb fact = [1, 1] [1, 1] fact n, k = map(int,input().split()) map(int,input().split()) n inv = [0, 1] [0, 1] inv N = 10**6 10**6 N ans = 0 0 ans k = map(int,input().split()) map(int,input().split()) k ans = (ans + cmb(n, i, mod) * cmb(n-1, i, mod)) % mod (ans + cmb(n, i, mod) * cmb(n-1, i, mod)) % mod ans factinv = [1, 1] [1, 1] factinv
def cmb(n, r, mod):
	if (r < 0) or (n < r):
		return 0
	r = min(r, n-r)
	return fact[n]*factinv[r]*factinv[n-r]%mod


mod = 10**9+7
N = 10**6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N+1):
	fact.append((fact[-1]*i)%mod)
	inv.append((-inv[mod%i]*(mod//i))%mod)
	factinv.append((factinv[-1]*inv[-1])%mod)

n, k = map(int,input().split())
ans = 0

for i in range(0, min(n, k+1)):
	#0がi個
	ans = (ans + cmb(n, i, mod) * cmb(n-1, i, mod)) % mod
print(ans)