import numpy as np

MOD=1000000007

n,k=map(int,input().split())
k=min(k,n-1)
fac=np.zeros((n+1)).astype(np.int64)
invfac=np.zeros((n+1)).astype(np.int64)
inv=np.zeros((n+1)).astype(np.int64)

invfac[0]=fac[0]=invfac[1]=fac[1]=inv[1]=1
for i in range(2,n+1):
    fac[i]=(fac[i-1]*i)%MOD
    inv[i]=(-inv[MOD%i]*(MOD//i))%MOD
    invfac[i]=(invfac[i-1]*inv[i])%MOD
def nCr(n,r):
    return ((fac[n]*invfac[r]%MOD)*invfac[n-r])%MOD
def nHr(n,r):
    return nCr(n+r-1,r)
    
print(np.sum(nCr(n,np.arange(k+1))*nHr(n-np.arange(k+1), np.arange(k+1))%MOD)%MOD) import numpy as np numpy MOD=1000000007 MOD 1000000007 n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k k=min(k,n-1) k min(k,n-1) min k n-1 n 1 fac=np.zeros((n+1)).astype(np.int64) fac np.zeros((n+1)).astype(np.int64) np.zeros((n+1)).astype np.zeros((n+1)) np.zeros np zeros n+1 n 1 astype np.int64 np int64 invfac=np.zeros((n+1)).astype(np.int64) invfac np.zeros((n+1)).astype(np.int64) np.zeros((n+1)).astype np.zeros((n+1)) np.zeros np zeros n+1 n 1 astype np.int64 np int64 inv=np.zeros((n+1)).astype(np.int64) inv np.zeros((n+1)).astype(np.int64) np.zeros((n+1)).astype np.zeros((n+1)) np.zeros np zeros n+1 n 1 astype np.int64 np int64 invfac[0]=fac[0]=invfac[1]=fac[1]=inv[1]=1 invfac[0] invfac 0 1 =fac[0]=invfac[1]=fac[1]=inv[1]=1 fac[0] fac 0 1 invfac[1] invfac 1 fac[1] fac 1 inv[1] inv 1 for i in range(2,n+1):
    fac[i]=(fac[i-1]*i)%MOD
    inv[i]=(-inv[MOD%i]*(MOD//i))%MOD
    invfac[i]=(invfac[i-1]*inv[i])%MOD i range(2,n+1) range 2 n+1 n 1 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 inv[i]=(-inv[MOD%i]*(MOD//i))%MOD inv[i] inv i (-inv[MOD%i]*(MOD//i))%MOD -inv[MOD%i]*(MOD//i) -inv[MOD%i] inv[MOD%i] inv MOD%i MOD i MOD//i MOD i MOD invfac[i]=(invfac[i-1]*inv[i])%MOD invfac[i] invfac i (invfac[i-1]*inv[i])%MOD invfac[i-1]*inv[i] invfac[i-1] invfac i-1 i 1 inv[i] inv i MOD def nCr(n,r):
    return ((fac[n]*invfac[r]%MOD)*invfac[n-r])%MOD nCr return ((fac[n]*invfac[r]%MOD)*invfac[n-r])%MOD ((fac[n]*invfac[r]%MOD)*invfac[n-r])%MOD (fac[n]*invfac[r]%MOD)*invfac[n-r] fac[n]*invfac[r]%MOD fac[n]*invfac[r] fac[n] fac n invfac[r] invfac r MOD invfac[n-r] invfac n-r n r MOD n n r r def nHr(n,r):
    return nCr(n+r-1,r)
     nHr return nCr(n+r-1,r) nCr(n+r-1,r) nCr n+r-1 n+r n r 1 r n n r r print(np.sum(nCr(n,np.arange(k+1))*nHr(n-np.arange(k+1), np.arange(k+1))%MOD)%MOD) print np.sum(nCr(n,np.arange(k+1))*nHr(n-np.arange(k+1), np.arange(k+1))%MOD)%MOD np.sum(nCr(n,np.arange(k+1))*nHr(n-np.arange(k+1), np.arange(k+1))%MOD) np.sum np sum nCr(n,np.arange(k+1))*nHr(n-np.arange(k+1), np.arange(k+1))%MOD nCr(n,np.arange(k+1))*nHr(n-np.arange(k+1), np.arange(k+1)) nCr(n,np.arange(k+1)) nCr n np.arange(k+1) np.arange np arange k+1 k 1 nHr(n-np.arange(k+1), np.arange(k+1)) nHr n-np.arange(k+1) n np.arange(k+1) np.arange np arange k+1 k 1 np.arange(k+1) np.arange np arange k+1 k 1 MOD MOD fac=np.zeros((n+1)).astype(np.int64) np.zeros((n+1)).astype(np.int64) fac inv=np.zeros((n+1)).astype(np.int64) np.zeros((n+1)).astype(np.int64) inv k=map(int,input().split()) map(int,input().split()) k def nCr(n,r):
    return ((fac[n]*invfac[r]%MOD)*invfac[n-r])%MOD def nCr(n,r):
    return ((fac[n]*invfac[r]%MOD)*invfac[n-r])%MOD nCr MOD=1000000007 1000000007 MOD def nHr(n,r):
    return nCr(n+r-1,r)
     def nHr(n,r):
    return nCr(n+r-1,r)
     nHr n,k=map(int,input().split()) map(int,input().split()) n k=min(k,n-1) min(k,n-1) k invfac=np.zeros((n+1)).astype(np.int64) np.zeros((n+1)).astype(np.int64) invfac
import numpy as np

MOD=1000000007

n,k=map(int,input().split())
k=min(k,n-1)
fac=np.zeros((n+1)).astype(np.int64)
invfac=np.zeros((n+1)).astype(np.int64)
inv=np.zeros((n+1)).astype(np.int64)

invfac[0]=fac[0]=invfac[1]=fac[1]=inv[1]=1
for i in range(2,n+1):
    fac[i]=(fac[i-1]*i)%MOD
    inv[i]=(-inv[MOD%i]*(MOD//i))%MOD
    invfac[i]=(invfac[i-1]*inv[i])%MOD
def nCr(n,r):
    return ((fac[n]*invfac[r]%MOD)*invfac[n-r])%MOD
def nHr(n,r):
    return nCr(n+r-1,r)
    
print(np.sum(nCr(n,np.arange(k+1))*nHr(n-np.arange(k+1), np.arange(k+1))%MOD)%MOD)
