mod = 10**9 + 7
max_N = 2 * 10**5

def power(b, e):
	if e == 0: return 1

	half = power(b, e // 2)

	if e % 2 == 0:
		return (half * half) % mod
	else:
		return (((half * half) % mod) * b) % mod

def mod_inv(n):
	return power(n, mod - 2)

fac = [1] * (max_N + 1)
for i in range(1, max_N + 1):
	fac[i] = (i * fac[i - 1]) % mod

fac_inv = [1] * (max_N + 1)
fac_inv[max_N] = mod_inv(fac[max_N])
for i in range(max_N - 1, -1, -1):
	fac_inv[i] = (fac_inv[i + 1] * (i + 1)) % mod

def choose(n, k):
	return (((fac[n] * fac_inv[k]) % mod) * fac_inv[n - k]) % mod


if __name__ == "__main__":
	line = input().split(" ")
	N, K = int(line[0]), int(line[1])
	K = min(K, N - 1)

	ans = 0
	for i in range(K + 1):
		ans = (ans + (choose(N, i) * choose(N - i - 1 + i, i)) % mod) % mod

	print(ans) mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 max_N = 2 * 10**5 max_N 2 * 10**5 2 10**5 10 5 def power(b, e):
	if e == 0: return 1

	half = power(b, e // 2)

	if e % 2 == 0:
		return (half * half) % mod
	else:
		return (((half * half) % mod) * b) % mod power if e == 0: return 1

	 e == 0 e 0 half = power(b, e // 2) half power(b, e // 2) power b e // 2 e 2 if e % 2 == 0:
		return (half * half) % mod
	else:
		return (((half * half) % mod) * b) % mod e % 2 == 0 e % 2 e 2 0 return (half * half) % mod (half * half) % mod half * half half half mod return (((half * half) % mod) * b) % mod (((half * half) % mod) * b) % mod ((half * half) % mod) * b (half * half) % mod half * half half half mod b mod b b e e def mod_inv(n):
	return power(n, mod - 2) mod_inv return power(n, mod - 2) power(n, mod - 2) power n mod - 2 mod 2 n n fac = [1] * (max_N + 1) fac [1] * (max_N + 1) [1] 1 max_N + 1 max_N 1 for i in range(1, max_N + 1):
	fac[i] = (i * fac[i - 1]) % mod i range(1, max_N + 1) range 1 max_N + 1 max_N 1 fac[i] = (i * fac[i - 1]) % mod fac[i] fac i (i * fac[i - 1]) % mod i * fac[i - 1] i fac[i - 1] fac i - 1 i 1 mod fac_inv = [1] * (max_N + 1) fac_inv [1] * (max_N + 1) [1] 1 max_N + 1 max_N 1 fac_inv[max_N] = mod_inv(fac[max_N]) fac_inv[max_N] fac_inv max_N mod_inv(fac[max_N]) mod_inv fac[max_N] fac max_N for i in range(max_N - 1, -1, -1):
	fac_inv[i] = (fac_inv[i + 1] * (i + 1)) % mod i range(max_N - 1, -1, -1) range max_N - 1 max_N 1 -1 -1 fac_inv[i] = (fac_inv[i + 1] * (i + 1)) % mod fac_inv[i] fac_inv i (fac_inv[i + 1] * (i + 1)) % mod fac_inv[i + 1] * (i + 1) fac_inv[i + 1] fac_inv i + 1 i 1 i + 1 i 1 mod def choose(n, k):
	return (((fac[n] * fac_inv[k]) % mod) * fac_inv[n - k]) % mod choose return (((fac[n] * fac_inv[k]) % mod) * fac_inv[n - k]) % mod (((fac[n] * fac_inv[k]) % mod) * fac_inv[n - k]) % mod ((fac[n] * fac_inv[k]) % mod) * fac_inv[n - k] (fac[n] * fac_inv[k]) % mod fac[n] * fac_inv[k] fac[n] fac n fac_inv[k] fac_inv k mod fac_inv[n - k] fac_inv n - k n k mod n n k k if __name__ == "__main__":
	line = input().split(" ")
	N, K = int(line[0]), int(line[1])
	K = min(K, N - 1)

	ans = 0
	for i in range(K + 1):
		ans = (ans + (choose(N, i) * choose(N - i - 1 + i, i)) % mod) % mod

	print(ans) __name__ == "__main__" __name__ "__main__" line = input().split(" ") line input().split(" ") ().split () input split " " N, K = int(line[0]), int(line[1]) N int(line[0]) int line[0] line 0 K int(line[1]) int line[1] line 1 K = min(K, N - 1) K min(K, N - 1) min K N - 1 N 1 ans = 0 ans 0 for i in range(K + 1):
		ans = (ans + (choose(N, i) * choose(N - i - 1 + i, i)) % mod) % mod

	 i range(K + 1) range K + 1 K 1 ans = (ans + (choose(N, i) * choose(N - i - 1 + i, i)) % mod) % mod ans (ans + (choose(N, i) * choose(N - i - 1 + i, i)) % mod) % mod ans + (choose(N, i) * choose(N - i - 1 + i, i)) % mod ans (choose(N, i) * choose(N - i - 1 + i, i)) % mod choose(N, i) * choose(N - i - 1 + i, i) choose(N, i) choose N i choose(N - i - 1 + i, i) choose N - i - 1 + i N - i - 1 N - i N i 1 i i mod mod print(ans) print ans ans = 0 0 ans mod = 10**9 + 7 10**9 + 7 mod def choose(n, k):
	return (((fac[n] * fac_inv[k]) % mod) * fac_inv[n - k]) % mod def choose(n, k):
	return (((fac[n] * fac_inv[k]) % mod) * fac_inv[n - k]) % mod choose fac_inv = [1] * (max_N + 1) [1] * (max_N + 1) fac_inv line = input().split(" ") input().split(" ") line ans = (ans + (choose(N, i) * choose(N - i - 1 + i, i)) % mod) % mod (ans + (choose(N, i) * choose(N - i - 1 + i, i)) % mod) % mod ans def power(b, e):
	if e == 0: return 1

	half = power(b, e // 2)

	if e % 2 == 0:
		return (half * half) % mod
	else:
		return (((half * half) % mod) * b) % mod def power(b, e):
	if e == 0: return 1

	half = power(b, e // 2)

	if e % 2 == 0:
		return (half * half) % mod
	else:
		return (((half * half) % mod) * b) % mod power fac = [1] * (max_N + 1) [1] * (max_N + 1) fac K = min(K, N - 1) min(K, N - 1) K max_N = 2 * 10**5 2 * 10**5 max_N def mod_inv(n):
	return power(n, mod - 2) def mod_inv(n):
	return power(n, mod - 2) mod_inv K = int(line[0]), int(line[1]) int(line[1]) K N, K = int(line[0]), int(line[1]) int(line[0]) N
mod = 10**9 + 7
max_N = 2 * 10**5

def power(b, e):
	if e == 0: return 1

	half = power(b, e // 2)

	if e % 2 == 0:
		return (half * half) % mod
	else:
		return (((half * half) % mod) * b) % mod

def mod_inv(n):
	return power(n, mod - 2)

fac = [1] * (max_N + 1)
for i in range(1, max_N + 1):
	fac[i] = (i * fac[i - 1]) % mod

fac_inv = [1] * (max_N + 1)
fac_inv[max_N] = mod_inv(fac[max_N])
for i in range(max_N - 1, -1, -1):
	fac_inv[i] = (fac_inv[i + 1] * (i + 1)) % mod

def choose(n, k):
	return (((fac[n] * fac_inv[k]) % mod) * fac_inv[n - k]) % mod


if __name__ == "__main__":
	line = input().split(" ")
	N, K = int(line[0]), int(line[1])
	K = min(K, N - 1)

	ans = 0
	for i in range(K + 1):
		ans = (ans + (choose(N, i) * choose(N - i - 1 + i, i)) % mod) % mod

	print(ans)