n,k=map(int,input().split())
mod=10**9+7
n_max=4*(10**5+1)
F,FI=[0]*(n_max+1),[0]*(n_max+1)
F[0],FI[0]=1,1
for i in range(n_max):
  F[i+1]=(F[i]*(i+1))%mod
FI[n_max-1]=pow(F[n_max-1],mod-2,mod)
for i in reversed(range(n_max-1)):
  FI[i]=(FI[i+1]*(i+1))%mod
def comb(x,y):
  return (F[x]*FI[x-y]*FI[y])%mod

if k>=n-1:
  print(comb(2*n-1,n))
else:
  ans=1
  for i in range(k):
    ans=(ans+comb(n,i+1)*comb(n-1,i+1))%mod

  print(ans) n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k mod=10**9+7 mod 10**9+7 10**9 10 9 7 n_max=4*(10**5+1) n_max 4*(10**5+1) 4 10**5+1 10**5 10 5 1 F,FI=[0]*(n_max+1),[0]*(n_max+1) F [0]*(n_max+1) [0] 0 n_max+1 n_max 1 FI [0]*(n_max+1) [0] 0 n_max+1 n_max 1 F[0],FI[0]=1,1 F[0] F 0 1 FI[0] FI 0 1 for i in range(n_max):
  F[i+1]=(F[i]*(i+1))%mod i range(n_max) range n_max F[i+1]=(F[i]*(i+1))%mod F[i+1] F i+1 i 1 (F[i]*(i+1))%mod F[i]*(i+1) F[i] F i i+1 i 1 mod FI[n_max-1]=pow(F[n_max-1],mod-2,mod) FI[n_max-1] FI n_max-1 n_max 1 pow(F[n_max-1],mod-2,mod) pow F[n_max-1] F n_max-1 n_max 1 mod-2 mod 2 mod for i in reversed(range(n_max-1)):
  FI[i]=(FI[i+1]*(i+1))%mod i reversed(range(n_max-1)) reversed range(n_max-1) range n_max-1 n_max 1 FI[i]=(FI[i+1]*(i+1))%mod FI[i] FI i (FI[i+1]*(i+1))%mod FI[i+1]*(i+1) FI[i+1] FI i+1 i 1 i+1 i 1 mod def comb(x,y):
  return (F[x]*FI[x-y]*FI[y])%mod comb return (F[x]*FI[x-y]*FI[y])%mod (F[x]*FI[x-y]*FI[y])%mod F[x]*FI[x-y]*FI[y] F[x]*FI[x-y] F[x] F x FI[x-y] FI x-y x y FI[y] FI y mod x x y y if k>=n-1:
  print(comb(2*n-1,n))
else:
  ans=1
  for i in range(k):
    ans=(ans+comb(n,i+1)*comb(n-1,i+1))%mod

  print(ans) k>=n-1 k n-1 n 1 print(comb(2*n-1,n)) print comb(2*n-1,n) comb 2*n-1 2*n 2 n 1 n ans=1 ans 1 for i in range(k):
    ans=(ans+comb(n,i+1)*comb(n-1,i+1))%mod

   i range(k) range k ans=(ans+comb(n,i+1)*comb(n-1,i+1))%mod ans (ans+comb(n,i+1)*comb(n-1,i+1))%mod ans+comb(n,i+1)*comb(n-1,i+1) ans comb(n,i+1)*comb(n-1,i+1) comb(n,i+1) comb n i+1 i 1 comb(n-1,i+1) comb n-1 n 1 i+1 i 1 mod print(ans) print ans k=map(int,input().split()) map(int,input().split()) k def comb(x,y):
  return (F[x]*FI[x-y]*FI[y])%mod def comb(x,y):
  return (F[x]*FI[x-y]*FI[y])%mod comb ans=1 1 ans ans=(ans+comb(n,i+1)*comb(n-1,i+1))%mod (ans+comb(n,i+1)*comb(n-1,i+1))%mod ans n,k=map(int,input().split()) map(int,input().split()) n n_max=4*(10**5+1) 4*(10**5+1) n_max F,FI=[0]*(n_max+1),[0]*(n_max+1) [0]*(n_max+1) F FI=[0]*(n_max+1),[0]*(n_max+1) [0]*(n_max+1) FI mod=10**9+7 10**9+7 mod
n,k=map(int,input().split())
mod=10**9+7
n_max=4*(10**5+1)
F,FI=[0]*(n_max+1),[0]*(n_max+1)
F[0],FI[0]=1,1
for i in range(n_max):
  F[i+1]=(F[i]*(i+1))%mod
FI[n_max-1]=pow(F[n_max-1],mod-2,mod)
for i in reversed(range(n_max-1)):
  FI[i]=(FI[i+1]*(i+1))%mod
def comb(x,y):
  return (F[x]*FI[x-y]*FI[y])%mod

if k>=n-1:
  print(comb(2*n-1,n))
else:
  ans=1
  for i in range(k):
    ans=(ans+comb(n,i+1)*comb(n-1,i+1))%mod

  print(ans)