import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return float(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()



def main():
	n,k=MI()
	mod=10**9+7

	f=[1]
	for i in range(1,n+10):
		f.append((f[-1]*i)%mod)
	finv=[]
	for i in f:
		finv.append(pow(i,mod-2,mod))

	ans=0
	for i in range(k+1):
		if n-i-1>=0:
			ans+=f[n]*finv[i]*finv[n-i]*f[n-1]*finv[i]*finv[n-i-1]
			ans%=mod
		else:
			break
	print(ans%mod)








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 def RD(): return input().rstrip().decode() RD def II(): return int(input()) II def FI(): return float(input()) FI def MI(): return map(int,input().split()) MI def MF(): return map(float,input().split()) MF def LI(): return list(map(int,input().split())) LI def LF(): return list(map(float,input().split())) LF def TI(): return tuple(map(int,input().split()))
# rstrip().decode() TI def main():
	n,k=MI()
	mod=10**9+7

	f=[1]
	for i in range(1,n+10):
		f.append((f[-1]*i)%mod)
	finv=[]
	for i in f:
		finv.append(pow(i,mod-2,mod))

	ans=0
	for i in range(k+1):
		if n-i-1>=0:
			ans+=f[n]*finv[i]*finv[n-i]*f[n-1]*finv[i]*finv[n-i-1]
			ans%=mod
		else:
			break
	print(ans%mod) main n,k=MI() n MI() MI k mod=10**9+7 mod 10**9+7 10**9 10 9 7 f=[1] f [1] 1 for i in range(1,n+10):
		f.append((f[-1]*i)%mod)
	 i range(1,n+10) range 1 n+10 n 10 f.append((f[-1]*i)%mod) f.append f append (f[-1]*i)%mod f[-1]*i f[-1] f -1 i mod finv=[] finv [] for i in f:
		finv.append(pow(i,mod-2,mod))

	 i f finv.append(pow(i,mod-2,mod)) finv.append finv append pow(i,mod-2,mod) pow i mod-2 mod 2 mod ans=0 ans 0 for i in range(k+1):
		if n-i-1>=0:
			ans+=f[n]*finv[i]*finv[n-i]*f[n-1]*finv[i]*finv[n-i-1]
			ans%=mod
		else:
			break
	 i range(k+1) range k+1 k 1 if n-i-1>=0:
			ans+=f[n]*finv[i]*finv[n-i]*f[n-1]*finv[i]*finv[n-i-1]
			ans%=mod
		else:
			break
	 n-i-1>=0 n-i-1 n-i n i 1 0 ans+=f[n]*finv[i]*finv[n-i]*f[n-1]*finv[i]*finv[n-i-1] ans f[n]*finv[i]*finv[n-i]*f[n-1]*finv[i]*finv[n-i-1] f[n]*finv[i]*finv[n-i]*f[n-1]*finv[i] f[n]*finv[i]*finv[n-i]*f[n-1] f[n]*finv[i]*finv[n-i] f[n]*finv[i] f[n] f n finv[i] finv i finv[n-i] finv n-i n i f[n-1] f n-1 n 1 finv[i] finv i finv[n-i-1] finv n-i-1 n-i n i 1 ans%=mod ans mod break print(ans%mod) print ans%mod ans mod if __name__ == "__main__":
	main() __name__ == "__main__" __name__ "__main__" main() main def TI(): return tuple(map(int,input().split()))
# rstrip().decode() def TI(): return tuple(map(int,input().split()))
# rstrip().decode() TI def MI(): return map(int,input().split()) def MI(): return map(int,input().split()) MI def LF(): return list(map(float,input().split())) def LF(): return list(map(float,input().split())) LF def II(): return int(input()) def II(): return int(input()) II input = sys.stdin.buffer.readline sys.stdin.buffer.readline input def FI(): return float(input()) def FI(): return float(input()) FI def LI(): return list(map(int,input().split())) def LI(): return list(map(int,input().split())) LI def main():
	n,k=MI()
	mod=10**9+7

	f=[1]
	for i in range(1,n+10):
		f.append((f[-1]*i)%mod)
	finv=[]
	for i in f:
		finv.append(pow(i,mod-2,mod))

	ans=0
	for i in range(k+1):
		if n-i-1>=0:
			ans+=f[n]*finv[i]*finv[n-i]*f[n-1]*finv[i]*finv[n-i-1]
			ans%=mod
		else:
			break
	print(ans%mod) def main():
	n,k=MI()
	mod=10**9+7

	f=[1]
	for i in range(1,n+10):
		f.append((f[-1]*i)%mod)
	finv=[]
	for i in f:
		finv.append(pow(i,mod-2,mod))

	ans=0
	for i in range(k+1):
		if n-i-1>=0:
			ans+=f[n]*finv[i]*finv[n-i]*f[n-1]*finv[i]*finv[n-i-1]
			ans%=mod
		else:
			break
	print(ans%mod) main def RD(): return input().rstrip().decode() def RD(): return input().rstrip().decode() RD def MF(): return map(float,input().split()) def MF(): return map(float,input().split()) MF
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return float(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()



def main():
	n,k=MI()
	mod=10**9+7

	f=[1]
	for i in range(1,n+10):
		f.append((f[-1]*i)%mod)
	finv=[]
	for i in f:
		finv.append(pow(i,mod-2,mod))

	ans=0
	for i in range(k+1):
		if n-i-1>=0:
			ans+=f[n]*finv[i]*finv[n-i]*f[n-1]*finv[i]*finv[n-i-1]
			ans%=mod
		else:
			break
	print(ans%mod)








if __name__ == "__main__":
	main()
