n,k=map(int,input().split())
fact=[1]
for i in range(1,2*n):
  fact.append((fact[i-1]*(i+1))%(10**9+7))
factinv=[]
for i in range(n):
  factinv.append(pow(fact[i],10**9+5,10**9+7))
if k==1:
  print((n*(n-1))%(10**9+7))
elif k>=n-1:
  print((fact[2*n-2]*factinv[n-1]*factinv[n-2])%(10**9+7))
else:
  ans=1
  for i in range (k):
    ans=(ans+fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i]*factinv[n-i-3])%(10**9+7)
  print(ans) n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k fact=[1] fact [1] 1 for i in range(1,2*n):
  fact.append((fact[i-1]*(i+1))%(10**9+7)) i range(1,2*n) range 1 2*n 2 n fact.append((fact[i-1]*(i+1))%(10**9+7)) fact.append fact append (fact[i-1]*(i+1))%(10**9+7) fact[i-1]*(i+1) fact[i-1] fact i-1 i 1 i+1 i 1 10**9+7 10**9 10 9 7 factinv=[] factinv [] for i in range(n):
  factinv.append(pow(fact[i],10**9+5,10**9+7)) i range(n) range n factinv.append(pow(fact[i],10**9+5,10**9+7)) factinv.append factinv append pow(fact[i],10**9+5,10**9+7) pow fact[i] fact i 10**9+5 10**9 10 9 5 10**9+7 10**9 10 9 7 if k==1:
  print((n*(n-1))%(10**9+7))
elif k>=n-1:
  print((fact[2*n-2]*factinv[n-1]*factinv[n-2])%(10**9+7))
else:
  ans=1
  for i in range (k):
    ans=(ans+fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i]*factinv[n-i-3])%(10**9+7)
  print(ans) k==1 k 1 print((n*(n-1))%(10**9+7)) print (n*(n-1))%(10**9+7) n*(n-1) n n-1 n 1 10**9+7 10**9 10 9 7 elif k>=n-1:
  print((fact[2*n-2]*factinv[n-1]*factinv[n-2])%(10**9+7)) k>=n-1 k n-1 n 1 print((fact[2*n-2]*factinv[n-1]*factinv[n-2])%(10**9+7)) print (fact[2*n-2]*factinv[n-1]*factinv[n-2])%(10**9+7) fact[2*n-2]*factinv[n-1]*factinv[n-2] fact[2*n-2]*factinv[n-1] fact[2*n-2] fact 2*n-2 2*n 2 n 2 factinv[n-1] factinv n-1 n 1 factinv[n-2] factinv n-2 n 2 10**9+7 10**9 10 9 7 ans=1 ans 1 for i in range (k):
    ans=(ans+fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i]*factinv[n-i-3])%(10**9+7)
   i range (k) range k ans=(ans+fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i]*factinv[n-i-3])%(10**9+7) ans (ans+fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i]*factinv[n-i-3])%(10**9+7) ans+fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i]*factinv[n-i-3] ans fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i]*factinv[n-i-3] fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i] fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2] fact[n-1]*factinv[i]*factinv[n-i-2] fact[n-1]*factinv[i] fact[n-1] fact n-1 n 1 factinv[i] factinv i factinv[n-i-2] factinv n-i-2 n-i n i 2 fact[n-2] fact n-2 n 2 factinv[i] factinv i factinv[n-i-3] factinv n-i-3 n-i n i 3 10**9+7 10**9 10 9 7 print(ans) print ans factinv=[] [] factinv k=map(int,input().split()) map(int,input().split()) k n,k=map(int,input().split()) map(int,input().split()) n ans=1 1 ans ans=(ans+fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i]*factinv[n-i-3])%(10**9+7) (ans+fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i]*factinv[n-i-3])%(10**9+7) ans fact=[1] [1] fact
n,k=map(int,input().split())
fact=[1]
for i in range(1,2*n):
  fact.append((fact[i-1]*(i+1))%(10**9+7))
factinv=[]
for i in range(n):
  factinv.append(pow(fact[i],10**9+5,10**9+7))
if k==1:
  print((n*(n-1))%(10**9+7))
elif k>=n-1:
  print((fact[2*n-2]*factinv[n-1]*factinv[n-2])%(10**9+7))
else:
  ans=1
  for i in range (k):
    ans=(ans+fact[n-1]*factinv[i]*factinv[n-i-2]*fact[n-2]*factinv[i]*factinv[n-i-3])%(10**9+7)
  print(ans)