SIZE=4*10**5+1; MOD=10**9+7 #998244353 #ここを変更する
 
SIZE += 1
inv = [0]*SIZE  # inv[j] = j^{-1} mod MOD
fac = [0]*SIZE  # fac[j] = j! mod MOD
finv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE):
    inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD
 
def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0
 
def chofuku(ball,box): # nHk mod MOD の計算
    return choose(box+ball-1,box)



N,K=map(int,input().split())
ans=0
for i in range(min(N,K+1)):
    ans+=choose(N,i)*chofuku(N-i,i)%MOD

print(ans%MOD)
 SIZE=4*10**5+1 SIZE 4*10**5+1 4*10**5 4 10**5 10 5 1 MOD=10**9+7 MOD 10**9+7 10**9 10 9 7 SIZE += 1 SIZE 1 inv = [0]*SIZE inv [0]*SIZE [0] 0 SIZE fac = [0]*SIZE fac [0]*SIZE [0] 0 SIZE finv = [0]*SIZE finv [0]*SIZE [0] 0 SIZE inv[1] = 1 inv[1] inv 1 1 fac[0] = fac[1] = 1 fac[0] fac 0 1 = fac[1] = 1 fac[1] fac 1 1 finv[0] = finv[1] = 1 finv[0] finv 0 1 = finv[1] = 1 finv[1] finv 1 1 for i in range(2,SIZE):
    inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD
  i range(2,SIZE) range 2 SIZE inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD inv[i] inv i MOD - (MOD//i)*inv[MOD%i]%MOD MOD (MOD//i)*inv[MOD%i]%MOD (MOD//i)*inv[MOD%i] MOD//i MOD i inv[MOD%i] inv MOD%i MOD i MOD fac[i] = fac[i-1]*i%MOD fac[i] fac i fac[i-1]*i%MOD fac[i-1]*i fac[i-1] fac i-1 i 1 i MOD finv[i]= finv[i-1]*inv[i]%MOD finv[i] finv i finv[i-1]*inv[i]%MOD finv[i-1]*inv[i] finv[i-1] finv i-1 i 1 inv[i] inv i MOD def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0
  choose if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0
  0 <= r <= n 0 <= r 0 r n return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD (fac[n]*finv[r]%MOD)*finv[n-r]%MOD (fac[n]*finv[r]%MOD)*finv[n-r] fac[n]*finv[r]%MOD fac[n]*finv[r] fac[n] fac n finv[r] finv r MOD finv[n-r] finv n-r n r MOD return 0 0 n n r r def chofuku(ball,box): # nHk mod MOD の計算
    return choose(box+ball-1,box) chofuku return choose(box+ball-1,box) choose(box+ball-1,box) choose box+ball-1 box+ball box ball 1 box ball ball box box N,K=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split K ans=0 ans 0 for i in range(min(N,K+1)):
    ans+=choose(N,i)*chofuku(N-i,i)%MOD i range(min(N,K+1)) range min(N,K+1) min N K+1 K 1 ans+=choose(N,i)*chofuku(N-i,i)%MOD ans choose(N,i)*chofuku(N-i,i)%MOD choose(N,i)*chofuku(N-i,i) choose(N,i) choose N i chofuku(N-i,i) chofuku N-i N i i MOD print(ans%MOD) print ans%MOD ans MOD inv = [0]*SIZE [0]*SIZE inv N,K=map(int,input().split()) map(int,input().split()) N MOD=10**9+7 10**9+7 MOD def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0
  def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0
  choose SIZE=4*10**5+1 4*10**5+1 SIZE SIZE += 1 1 SIZE finv = [0]*SIZE [0]*SIZE finv K=map(int,input().split()) map(int,input().split()) K def chofuku(ball,box): # nHk mod MOD の計算
    return choose(box+ball-1,box) def chofuku(ball,box): # nHk mod MOD の計算
    return choose(box+ball-1,box) chofuku ans+=choose(N,i)*chofuku(N-i,i)%MOD choose(N,i)*chofuku(N-i,i)%MOD ans fac = [0]*SIZE [0]*SIZE fac ans=0 0 ans
SIZE=4*10**5+1; MOD=10**9+7 #998244353 #ここを変更する
 
SIZE += 1
inv = [0]*SIZE  # inv[j] = j^{-1} mod MOD
fac = [0]*SIZE  # fac[j] = j! mod MOD
finv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE):
    inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD
 
def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0
 
def chofuku(ball,box): # nHk mod MOD の計算
    return choose(box+ball-1,box)



N,K=map(int,input().split())
ans=0
for i in range(min(N,K+1)):
    ans+=choose(N,i)*chofuku(N-i,i)%MOD

print(ans%MOD)

