import sys
input = sys.stdin.buffer.readline
import copy

def main():
    N,K = map(int,input().split())
    MOD = 10**9+7

    fac = [0 for _ in range(2*10**5+1)]
    fac[0],fac[1] = 1,1
    inv = copy.deepcopy(fac)
    invfac = copy.deepcopy(fac)
    
    for i in range(2,2*10**5+1):
        fac[i] = (fac[i-1]*i)%MOD
        inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD
        invfac[i] = (invfac[i-1]*inv[i])%MOD

    def coef(x,y):
        num = (((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD)
        return num
    
    ans = 0
    for i in range(min(N,K+1)):
        a = coef(N,i)
        b = coef(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 import copy copy def main():
    N,K = map(int,input().split())
    MOD = 10**9+7

    fac = [0 for _ in range(2*10**5+1)]
    fac[0],fac[1] = 1,1
    inv = copy.deepcopy(fac)
    invfac = copy.deepcopy(fac)
    
    for i in range(2,2*10**5+1):
        fac[i] = (fac[i-1]*i)%MOD
        inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD
        invfac[i] = (invfac[i-1]*inv[i])%MOD

    def coef(x,y):
        num = (((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD)
        return num
    
    ans = 0
    for i in range(min(N,K+1)):
        a = coef(N,i)
        b = coef(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 0 for _ in range(2*10**5+1) for _ in range(2*10**5+1) _ range(2*10**5+1) range 2*10**5+1 2*10**5 2 10**5 10 5 1 for _ in range(2*10**5+1) 0 fac = [0 for _ in range(2*10**5+1)] fac [0 for _ in range(2*10**5+1)] fac[0],fac[1] = 1,1 fac[0] fac 0 1 fac[1] fac 1 1 inv = copy.deepcopy(fac) inv copy.deepcopy(fac) copy.deepcopy copy deepcopy fac invfac = copy.deepcopy(fac) invfac copy.deepcopy(fac) copy.deepcopy copy deepcopy fac for i in range(2,2*10**5+1):
        fac[i] = (fac[i-1]*i)%MOD
        inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD
        invfac[i] = (invfac[i-1]*inv[i])%MOD

     i range(2,2*10**5+1) range 2 2*10**5+1 2*10**5 2 10**5 10 5 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] = 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 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 coef(x,y):
        num = (((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD)
        return num
    
     coef num = (((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD) num ((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD ((fac[x]*invfac[y])%MOD)*invfac[x-y] (fac[x]*invfac[y])%MOD fac[x]*invfac[y] fac[x] fac x invfac[y] invfac y MOD invfac[x-y] invfac x-y x y MOD return num num x x y y ans = 0 ans 0 for i in range(min(N,K+1)):
        a = coef(N,i)
        b = coef(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 = coef(N,i) a coef(N,i) coef N i b = coef(N-1,N-i-1) b coef(N-1,N-i-1) coef 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 for _ in range(2*10**5+1)]
    fac[0],fac[1] = 1,1
    inv = copy.deepcopy(fac)
    invfac = copy.deepcopy(fac)
    
    for i in range(2,2*10**5+1):
        fac[i] = (fac[i-1]*i)%MOD
        inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD
        invfac[i] = (invfac[i-1]*inv[i])%MOD

    def coef(x,y):
        num = (((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD)
        return num
    
    ans = 0
    for i in range(min(N,K+1)):
        a = coef(N,i)
        b = coef(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 for _ in range(2*10**5+1)]
    fac[0],fac[1] = 1,1
    inv = copy.deepcopy(fac)
    invfac = copy.deepcopy(fac)
    
    for i in range(2,2*10**5+1):
        fac[i] = (fac[i-1]*i)%MOD
        inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD
        invfac[i] = (invfac[i-1]*inv[i])%MOD

    def coef(x,y):
        num = (((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD)
        return num
    
    ans = 0
    for i in range(min(N,K+1)):
        a = coef(N,i)
        b = coef(N-1,N-i-1)
        ans += ((a*b)%MOD)
        
    print(ans%MOD)
     main
import sys
input = sys.stdin.buffer.readline
import copy

def main():
    N,K = map(int,input().split())
    MOD = 10**9+7

    fac = [0 for _ in range(2*10**5+1)]
    fac[0],fac[1] = 1,1
    inv = copy.deepcopy(fac)
    invfac = copy.deepcopy(fac)
    
    for i in range(2,2*10**5+1):
        fac[i] = (fac[i-1]*i)%MOD
        inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD
        invfac[i] = (invfac[i-1]*inv[i])%MOD

    def coef(x,y):
        num = (((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD)
        return num
    
    ans = 0
    for i in range(min(N,K+1)):
        a = coef(N,i)
        b = coef(N-1,N-i-1)
        ans += ((a*b)%MOD)
        
    print(ans%MOD)
    
if __name__ == "__main__":
    main()