import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))


def main():
    mod=10**9+7
    N,K=MI()
    
    def cmb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return (fact[n] * factinv[r] * factinv[n-r])%mod

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]

    for i in range(2, N*2 + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)

    ans=0
    
    #空き部屋がk個
    for i in range(min(K+1,N)):
        a=i#動く人
        b=N-i#割り当てる部屋
        temp=cmb(a+b-1,a,mod)
        
        #空き部屋の選び方
        temp2=cmb(N,i,mod)
        temp*=temp2
        
        ans=(ans+temp)%mod
        
    print(ans)
        
    

main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def I(): return int(input()) I def MI(): return map(int, input().split()) MI def LI(): return list(map(int, input().split())) LI def main():
    mod=10**9+7
    N,K=MI()
    
    def cmb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return (fact[n] * factinv[r] * factinv[n-r])%mod

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]

    for i in range(2, N*2 + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)

    ans=0
    
    #空き部屋がk個
    for i in range(min(K+1,N)):
        a=i#動く人
        b=N-i#割り当てる部屋
        temp=cmb(a+b-1,a,mod)
        
        #空き部屋の選び方
        temp2=cmb(N,i,mod)
        temp*=temp2
        
        ans=(ans+temp)%mod
        
    print(ans)
        
     main mod=10**9+7 mod 10**9+7 10**9 10 9 7 N,K=MI() N MI() MI K def cmb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return (fact[n] * factinv[r] * factinv[n-r])%mod

     cmb if (r < 0) or (n < r):
            return 0
         (r < 0) or (n < r) r < 0 r 0 n < r n r return 0 0 r = min(r, n - r) r min(r, n - r) min r n - r n r return (fact[n] * factinv[r] * factinv[n-r])%mod (fact[n] * factinv[r] * factinv[n-r])%mod fact[n] * factinv[r] * factinv[n-r] fact[n] * factinv[r] fact[n] fact n factinv[r] factinv r factinv[n-r] factinv n-r n r mod n n r r mod mod fact=[1,1] fact [1,1] 1 1 factinv=[1,1] factinv [1,1] 1 1 inv=[0,1] inv [0,1] 0 1 for i in range(2, N*2 + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)

     i range(2, N*2 + 1) range 2 N*2 + 1 N*2 N 2 1 fact.append((fact[-1] * i) % mod) fact.append fact append (fact[-1] * i) % mod fact[-1] * i fact[-1] fact -1 i mod inv.append((-inv[mod % i] * (mod // i)) % mod) inv.append inv append (-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 factinv.append((factinv[-1] * inv[-1]) % mod) factinv.append factinv append (factinv[-1] * inv[-1]) % mod factinv[-1] * inv[-1] factinv[-1] factinv -1 inv[-1] inv -1 mod ans=0 ans 0 for i in range(min(K+1,N)):
        a=i#動く人
        b=N-i#割り当てる部屋
        temp=cmb(a+b-1,a,mod)
        
        #空き部屋の選び方
        temp2=cmb(N,i,mod)
        temp*=temp2
        
        ans=(ans+temp)%mod
        
     i range(min(K+1,N)) range min(K+1,N) min K+1 K 1 N a=i a i b=N-i b N-i N i temp=cmb(a+b-1,a,mod) temp cmb(a+b-1,a,mod) cmb a+b-1 a+b a b 1 a mod temp2=cmb(N,i,mod) temp2 cmb(N,i,mod) cmb N i mod temp*=temp2 temp temp2 ans=(ans+temp)%mod ans (ans+temp)%mod ans+temp ans temp mod print(ans) print ans main() main def I(): return int(input()) def I(): return int(input()) I def MI(): return map(int, input().split()) def MI(): return map(int, input().split()) MI def main():
    mod=10**9+7
    N,K=MI()
    
    def cmb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return (fact[n] * factinv[r] * factinv[n-r])%mod

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]

    for i in range(2, N*2 + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)

    ans=0
    
    #空き部屋がk個
    for i in range(min(K+1,N)):
        a=i#動く人
        b=N-i#割り当てる部屋
        temp=cmb(a+b-1,a,mod)
        
        #空き部屋の選び方
        temp2=cmb(N,i,mod)
        temp*=temp2
        
        ans=(ans+temp)%mod
        
    print(ans)
        
     def main():
    mod=10**9+7
    N,K=MI()
    
    def cmb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return (fact[n] * factinv[r] * factinv[n-r])%mod

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]

    for i in range(2, N*2 + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)

    ans=0
    
    #空き部屋がk個
    for i in range(min(K+1,N)):
        a=i#動く人
        b=N-i#割り当てる部屋
        temp=cmb(a+b-1,a,mod)
        
        #空き部屋の選び方
        temp2=cmb(N,i,mod)
        temp*=temp2
        
        ans=(ans+temp)%mod
        
    print(ans)
        
     main def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI input = sys.stdin.readline sys.stdin.readline input
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))


def main():
    mod=10**9+7
    N,K=MI()
    
    def cmb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return (fact[n] * factinv[r] * factinv[n-r])%mod

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]

    for i in range(2, N*2 + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)

    ans=0
    
    #空き部屋がk個
    for i in range(min(K+1,N)):
        a=i#動く人
        b=N-i#割り当てる部屋
        temp=cmb(a+b-1,a,mod)
        
        #空き部屋の選び方
        temp2=cmb(N,i,mod)
        temp*=temp2
        
        ans=(ans+temp)%mod
        
    print(ans)
        
    

main()
