import sys
input = sys.stdin.buffer.readline

def main():
    N,K = map(int,input().split())
    MOD = 10**9+7
    
    fac = [0]*(N+1)
    invfac = [0]*(N+1)
    fac[0],fac[1] = 1,1
    invfac[0],invfac[1] = 1,1
    
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    invfac[-1] = pow(fac[-1],MOD-2,MOD)
    for i in range(N,0,-1):
        invfac[i-1] = (invfac[i]*i)%MOD
        
    def comb(x,y):
        return (fac[x]*invfac[y]*invfac[x-y])%MOD
        
    ans = 0
    for i in range(min(N,K+1)):
        a = comb(N,i)
        b = comb(N-1,N-i-1)
        ans += (a*b)%MOD
        
    print(ans%MOD)

if __name__ == "__main__":
    main() import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline def main():
    N,K = map(int,input().split())
    MOD = 10**9+7
    
    fac = [0]*(N+1)
    invfac = [0]*(N+1)
    fac[0],fac[1] = 1,1
    invfac[0],invfac[1] = 1,1
    
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    invfac[-1] = pow(fac[-1],MOD-2,MOD)
    for i in range(N,0,-1):
        invfac[i-1] = (invfac[i]*i)%MOD
        
    def comb(x,y):
        return (fac[x]*invfac[y]*invfac[x-y])%MOD
        
    ans = 0
    for i in range(min(N,K+1)):
        a = comb(N,i)
        b = comb(N-1,N-i-1)
        ans += (a*b)%MOD
        
    print(ans%MOD) main 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 fac = [0]*(N+1) fac [0]*(N+1) [0] 0 N+1 N 1 invfac = [0]*(N+1) invfac [0]*(N+1) [0] 0 N+1 N 1 fac[0],fac[1] = 1,1 fac[0] fac 0 1 fac[1] fac 1 1 invfac[0],invfac[1] = 1,1 invfac[0] invfac 0 1 invfac[1] invfac 1 1 for i in range(2,N+1):
        fac[i] = (fac[i-1]*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 invfac[-1] = pow(fac[-1],MOD-2,MOD) invfac[-1] invfac -1 pow(fac[-1],MOD-2,MOD) pow fac[-1] fac -1 MOD-2 MOD 2 MOD for i in range(N,0,-1):
        invfac[i-1] = (invfac[i]*i)%MOD
        
     i range(N,0,-1) range N 0 -1 invfac[i-1] = (invfac[i]*i)%MOD invfac[i-1] invfac i-1 i 1 (invfac[i]*i)%MOD invfac[i]*i invfac[i] invfac i i MOD def comb(x,y):
        return (fac[x]*invfac[y]*invfac[x-y])%MOD
        
     comb return (fac[x]*invfac[y]*invfac[x-y])%MOD (fac[x]*invfac[y]*invfac[x-y])%MOD fac[x]*invfac[y]*invfac[x-y] fac[x]*invfac[y] fac[x] fac x invfac[y] invfac y invfac[x-y] invfac x-y x y MOD x x y y ans = 0 ans 0 for i in range(min(N,K+1)):
        a = comb(N,i)
        b = comb(N-1,N-i-1)
        ans += (a*b)%MOD
        
     i range(min(N,K+1)) range min(N,K+1) min N K+1 K 1 a = comb(N,i) a comb(N,i) comb N i b = comb(N-1,N-i-1) b comb(N-1,N-i-1) comb N-1 N 1 N-i-1 N-i N i 1 ans += (a*b)%MOD ans (a*b)%MOD a*b a b MOD print(ans%MOD) print ans%MOD ans MOD if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main input = sys.stdin.buffer.readline sys.stdin.buffer.readline input def main():
    N,K = map(int,input().split())
    MOD = 10**9+7
    
    fac = [0]*(N+1)
    invfac = [0]*(N+1)
    fac[0],fac[1] = 1,1
    invfac[0],invfac[1] = 1,1
    
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    invfac[-1] = pow(fac[-1],MOD-2,MOD)
    for i in range(N,0,-1):
        invfac[i-1] = (invfac[i]*i)%MOD
        
    def comb(x,y):
        return (fac[x]*invfac[y]*invfac[x-y])%MOD
        
    ans = 0
    for i in range(min(N,K+1)):
        a = comb(N,i)
        b = comb(N-1,N-i-1)
        ans += (a*b)%MOD
        
    print(ans%MOD) def main():
    N,K = map(int,input().split())
    MOD = 10**9+7
    
    fac = [0]*(N+1)
    invfac = [0]*(N+1)
    fac[0],fac[1] = 1,1
    invfac[0],invfac[1] = 1,1
    
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    invfac[-1] = pow(fac[-1],MOD-2,MOD)
    for i in range(N,0,-1):
        invfac[i-1] = (invfac[i]*i)%MOD
        
    def comb(x,y):
        return (fac[x]*invfac[y]*invfac[x-y])%MOD
        
    ans = 0
    for i in range(min(N,K+1)):
        a = comb(N,i)
        b = comb(N-1,N-i-1)
        ans += (a*b)%MOD
        
    print(ans%MOD) main
import sys
input = sys.stdin.buffer.readline

def main():
    N,K = map(int,input().split())
    MOD = 10**9+7
    
    fac = [0]*(N+1)
    invfac = [0]*(N+1)
    fac[0],fac[1] = 1,1
    invfac[0],invfac[1] = 1,1
    
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    invfac[-1] = pow(fac[-1],MOD-2,MOD)
    for i in range(N,0,-1):
        invfac[i-1] = (invfac[i]*i)%MOD
        
    def comb(x,y):
        return (fac[x]*invfac[y]*invfac[x-y])%MOD
        
    ans = 0
    for i in range(min(N,K+1)):
        a = comb(N,i)
        b = comb(N-1,N-i-1)
        ans += (a*b)%MOD
        
    print(ans%MOD)

if __name__ == "__main__":
    main()
