def nCr_frL(n,r,mod):
    ret=[1,n%mod]
    for i in range(2,r+1):
        inv=pow(i,mod-2,mod)
        ret.append((ret[-1]*(n-i+1)*inv)%mod)
    return ret

N,K=map(int,input().split())
MOD=10**9+7
com1=nCr_frL(N,N,MOD) # nCi
com2=nCr_frL(N-1,N-1,MOD) # n-1Ci

if K>N-1:
    K=N-1
ans=0
for m in range(K+1):
    ans+=(com1[m]*com2[N-m-1])%MOD
print(ans%MOD)
 def nCr_frL(n,r,mod):
    ret=[1,n%mod]
    for i in range(2,r+1):
        inv=pow(i,mod-2,mod)
        ret.append((ret[-1]*(n-i+1)*inv)%mod)
    return ret nCr_frL ret=[1,n%mod] ret [1,n%mod] 1 n%mod n mod for i in range(2,r+1):
        inv=pow(i,mod-2,mod)
        ret.append((ret[-1]*(n-i+1)*inv)%mod)
     i range(2,r+1) range 2 r+1 r 1 inv=pow(i,mod-2,mod) inv pow(i,mod-2,mod) pow i mod-2 mod 2 mod ret.append((ret[-1]*(n-i+1)*inv)%mod) ret.append ret append (ret[-1]*(n-i+1)*inv)%mod ret[-1]*(n-i+1)*inv ret[-1]*(n-i+1) ret[-1] ret -1 n-i+1 n-i n i 1 inv mod return ret ret n n r r mod mod 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 com1=nCr_frL(N,N,MOD) com1 nCr_frL(N,N,MOD) nCr_frL N N MOD com2=nCr_frL(N-1,N-1,MOD) com2 nCr_frL(N-1,N-1,MOD) nCr_frL N-1 N 1 N-1 N 1 MOD if K>N-1:
    K=N-1 K>N-1 K N-1 N 1 K=N-1 K N-1 N 1 ans=0 ans 0 for m in range(K+1):
    ans+=(com1[m]*com2[N-m-1])%MOD m range(K+1) range K+1 K 1 ans+=(com1[m]*com2[N-m-1])%MOD ans (com1[m]*com2[N-m-1])%MOD com1[m]*com2[N-m-1] com1[m] com1 m com2[N-m-1] com2 N-m-1 N-m N m 1 MOD print(ans%MOD) print ans%MOD ans MOD ans=0 0 ans K=map(int,input().split()) map(int,input().split()) K N,K=map(int,input().split()) map(int,input().split()) N ans+=(com1[m]*com2[N-m-1])%MOD (com1[m]*com2[N-m-1])%MOD ans MOD=10**9+7 10**9+7 MOD K=N-1 N-1 K def nCr_frL(n,r,mod):
    ret=[1,n%mod]
    for i in range(2,r+1):
        inv=pow(i,mod-2,mod)
        ret.append((ret[-1]*(n-i+1)*inv)%mod)
    return ret def nCr_frL(n,r,mod):
    ret=[1,n%mod]
    for i in range(2,r+1):
        inv=pow(i,mod-2,mod)
        ret.append((ret[-1]*(n-i+1)*inv)%mod)
    return ret nCr_frL com1=nCr_frL(N,N,MOD) nCr_frL(N,N,MOD) com1 com2=nCr_frL(N-1,N-1,MOD) nCr_frL(N-1,N-1,MOD) com2
def nCr_frL(n,r,mod):
    ret=[1,n%mod]
    for i in range(2,r+1):
        inv=pow(i,mod-2,mod)
        ret.append((ret[-1]*(n-i+1)*inv)%mod)
    return ret

N,K=map(int,input().split())
MOD=10**9+7
com1=nCr_frL(N,N,MOD) # nCi
com2=nCr_frL(N-1,N-1,MOD) # n-1Ci

if K>N-1:
    K=N-1
ans=0
for m in range(K+1):
    ans+=(com1[m]*com2[N-m-1])%MOD
print(ans%MOD)

