#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

class Combination(object):
	def __init__(self, N, con):
		self.fac = [0] * (N + 1)
		self.inv = [0] * (N + 1)
		self.finv = [0] * (N + 1)
		self.fac[0], self.fac[1] = 1, 1
		self.inv[1] = 1
		self.finv[0], self.finv[1] = 1, 1

		# 前計算
		for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	def com(self, N, k):
		return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con

#処理内容
def main():
	N, K = getlist()
	if K >= N:
		Com = Combination(2 * N - 1, con)
		ans = Com.com(2 * N - 1, N)
		print(ans)

	else:
		Com1 = Combination(N, con)
		Com2 = Combination(N - 1, con)
		ans = 0
		for i in range(1, K + 1):
			ans += Com1.com(N, i) * Com2.com(N - 1, i)
			ans %= con
		ans = (ans + 1) % con
		print(ans)
	
if __name__ == '__main__':
	main() import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline from collections import defaultdict con = 10 ** 9 + 7 con 10 ** 9 + 7 10 ** 9 10 9 7 def getlist():
	return list(map(int, input().split())) getlist return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split class Combination(object):
	def __init__(self, N, con):
		self.fac = [0] * (N + 1)
		self.inv = [0] * (N + 1)
		self.finv = [0] * (N + 1)
		self.fac[0], self.fac[1] = 1, 1
		self.inv[1] = 1
		self.finv[0], self.finv[1] = 1, 1

		# 前計算
		for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	def com(self, N, k):
		return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con

#処理内容 Combination def __init__(self, N, con):
		self.fac = [0] * (N + 1)
		self.inv = [0] * (N + 1)
		self.finv = [0] * (N + 1)
		self.fac[0], self.fac[1] = 1, 1
		self.inv[1] = 1
		self.finv[0], self.finv[1] = 1, 1

		# 前計算
		for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	 __init__ self.fac = [0] * (N + 1) self.fac self fac [0] * (N + 1) [0] 0 N + 1 N 1 self.inv = [0] * (N + 1) self.inv self inv [0] * (N + 1) [0] 0 N + 1 N 1 self.finv = [0] * (N + 1) self.finv self finv [0] * (N + 1) [0] 0 N + 1 N 1 self.fac[0], self.fac[1] = 1, 1 self.fac[0] self.fac self fac 0 1 self.fac[1] self.fac self fac 1 1 self.inv[1] = 1 self.inv[1] self.inv self inv 1 1 self.finv[0], self.finv[1] = 1, 1 self.finv[0] self.finv self finv 0 1 self.finv[1] self.finv self finv 1 1 for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	 i range(2, N + 1) range 2 N + 1 N 1 self.fac[i] = self.fac[i - 1] * i % con self.fac[i] self.fac self fac i self.fac[i - 1] * i % con self.fac[i - 1] * i self.fac[i - 1] self.fac self fac i - 1 i 1 i con self.inv[i] = self.inv[con % i] * (con - (con // i)) % con self.inv[i] self.inv self inv i self.inv[con % i] * (con - (con // i)) % con self.inv[con % i] * (con - (con // i)) self.inv[con % i] self.inv self inv con % i con i con - (con // i) con con // i con i con self.finv[i] = self.finv[i - 1] * self.inv[i] % con self.finv[i] self.finv self finv i self.finv[i - 1] * self.inv[i] % con self.finv[i - 1] * self.inv[i] self.finv[i - 1] self.finv self finv i - 1 i 1 self.inv[i] self.inv self inv i con self self N N con con def com(self, N, k):
		return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con

#処理内容 com return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con (self.fac[N] * self.finv[k] * self.finv[N - k]) % con self.fac[N] * self.finv[k] * self.finv[N - k] self.fac[N] * self.finv[k] self.fac[N] self.fac self fac N self.finv[k] self.finv self finv k self.finv[N - k] self.finv self finv N - k N k con self self N N k k object def main():
	N, K = getlist()
	if K >= N:
		Com = Combination(2 * N - 1, con)
		ans = Com.com(2 * N - 1, N)
		print(ans)

	else:
		Com1 = Combination(N, con)
		Com2 = Combination(N - 1, con)
		ans = 0
		for i in range(1, K + 1):
			ans += Com1.com(N, i) * Com2.com(N - 1, i)
			ans %= con
		ans = (ans + 1) % con
		print(ans)
	 main N, K = getlist() N getlist() getlist K if K >= N:
		Com = Combination(2 * N - 1, con)
		ans = Com.com(2 * N - 1, N)
		print(ans)

	else:
		Com1 = Combination(N, con)
		Com2 = Combination(N - 1, con)
		ans = 0
		for i in range(1, K + 1):
			ans += Com1.com(N, i) * Com2.com(N - 1, i)
			ans %= con
		ans = (ans + 1) % con
		print(ans)
	 K >= N K N Com = Combination(2 * N - 1, con) Com Combination(2 * N - 1, con) Combination 2 * N - 1 2 * N 2 N 1 con ans = Com.com(2 * N - 1, N) ans Com.com(2 * N - 1, N) Com.com Com com 2 * N - 1 2 * N 2 N 1 N print(ans) print ans Com1 = Combination(N, con) Com1 Combination(N, con) Combination N con Com2 = Combination(N - 1, con) Com2 Combination(N - 1, con) Combination N - 1 N 1 con ans = 0 ans 0 for i in range(1, K + 1):
			ans += Com1.com(N, i) * Com2.com(N - 1, i)
			ans %= con
		 i range(1, K + 1) range 1 K + 1 K 1 ans += Com1.com(N, i) * Com2.com(N - 1, i) ans Com1.com(N, i) * Com2.com(N - 1, i) Com1.com(N, i) Com1.com Com1 com N i Com2.com(N - 1, i) Com2.com Com2 com N - 1 N 1 i ans %= con ans con ans = (ans + 1) % con ans (ans + 1) % con ans + 1 ans 1 con print(ans) print ans if __name__ == '__main__':
	main() __name__ == '__main__' __name__ '__main__' main() main class Combination(object):
	def __init__(self, N, con):
		self.fac = [0] * (N + 1)
		self.inv = [0] * (N + 1)
		self.finv = [0] * (N + 1)
		self.fac[0], self.fac[1] = 1, 1
		self.inv[1] = 1
		self.finv[0], self.finv[1] = 1, 1

		# 前計算
		for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	def com(self, N, k):
		return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con

#処理内容 class Combination(object):
	def __init__(self, N, con):
		self.fac = [0] * (N + 1)
		self.inv = [0] * (N + 1)
		self.finv = [0] * (N + 1)
		self.fac[0], self.fac[1] = 1, 1
		self.inv[1] = 1
		self.finv[0], self.finv[1] = 1, 1

		# 前計算
		for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	def com(self, N, k):
		return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con

#処理内容 Combination input = sys.stdin.buffer.readline sys.stdin.buffer.readline input def getlist():
	return list(map(int, input().split())) def getlist():
	return list(map(int, input().split())) getlist con = 10 ** 9 + 7 10 ** 9 + 7 con def main():
	N, K = getlist()
	if K >= N:
		Com = Combination(2 * N - 1, con)
		ans = Com.com(2 * N - 1, N)
		print(ans)

	else:
		Com1 = Combination(N, con)
		Com2 = Combination(N - 1, con)
		ans = 0
		for i in range(1, K + 1):
			ans += Com1.com(N, i) * Com2.com(N - 1, i)
			ans %= con
		ans = (ans + 1) % con
		print(ans)
	 def main():
	N, K = getlist()
	if K >= N:
		Com = Combination(2 * N - 1, con)
		ans = Com.com(2 * N - 1, N)
		print(ans)

	else:
		Com1 = Combination(N, con)
		Com2 = Combination(N - 1, con)
		ans = 0
		for i in range(1, K + 1):
			ans += Com1.com(N, i) * Com2.com(N - 1, i)
			ans %= con
		ans = (ans + 1) % con
		print(ans)
	 main
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

class Combination(object):
	def __init__(self, N, con):
		self.fac = [0] * (N + 1)
		self.inv = [0] * (N + 1)
		self.finv = [0] * (N + 1)
		self.fac[0], self.fac[1] = 1, 1
		self.inv[1] = 1
		self.finv[0], self.finv[1] = 1, 1

		# 前計算
		for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	def com(self, N, k):
		return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con

#処理内容
def main():
	N, K = getlist()
	if K >= N:
		Com = Combination(2 * N - 1, con)
		ans = Com.com(2 * N - 1, N)
		print(ans)

	else:
		Com1 = Combination(N, con)
		Com2 = Combination(N - 1, con)
		ans = 0
		for i in range(1, K + 1):
			ans += Com1.com(N, i) * Com2.com(N - 1, i)
			ans %= con
		ans = (ans + 1) % con
		print(ans)
	
if __name__ == '__main__':
	main()