
import numpy as np

class Combination : 
    def __init__ (self, N=10**6, mod=10**9+7) :
        self.mod = mod
        self.fact = [1, 1]
        self.factinv = [1, 1]
        self.inv = [0, 1]
        for i in range(2, N+1) :
            self.fact.append( (self.fact[-1]  * i) % mod )
            self.inv .append( (-self.inv[mod%i] * (mod//i) ) % mod )
            self.factinv.append( (self.factinv[-1] * self.inv[-1]) % mod )

    def nCr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        r = min(r, n-r)
        return self.fact[n]*self.factinv[r]*self.factinv[n-r] % self.mod

    def nPr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        return self.fact[n]*self.factinv[n-r] % self.mod


n, k = map(int, input().split())

mod = 10**9+7
comb = Combination(2*10**5+100)
ans = 0
for m in range(min(n+1,k+1)) :
    ans = ans%mod + (comb.nCr(n,m) * comb.nCr(n-1, n-m-1))%mod
print(ans%mod) import numpy as np numpy class Combination : 
    def __init__ (self, N=10**6, mod=10**9+7) :
        self.mod = mod
        self.fact = [1, 1]
        self.factinv = [1, 1]
        self.inv = [0, 1]
        for i in range(2, N+1) :
            self.fact.append( (self.fact[-1]  * i) % mod )
            self.inv .append( (-self.inv[mod%i] * (mod//i) ) % mod )
            self.factinv.append( (self.factinv[-1] * self.inv[-1]) % mod )

    def nCr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        r = min(r, n-r)
        return self.fact[n]*self.factinv[r]*self.factinv[n-r] % self.mod

    def nPr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        return self.fact[n]*self.factinv[n-r] % self.mod Combination def __init__ (self, N=10**6, mod=10**9+7) :
        self.mod = mod
        self.fact = [1, 1]
        self.factinv = [1, 1]
        self.inv = [0, 1]
        for i in range(2, N+1) :
            self.fact.append( (self.fact[-1]  * i) % mod )
            self.inv .append( (-self.inv[mod%i] * (mod//i) ) % mod )
            self.factinv.append( (self.factinv[-1] * self.inv[-1]) % mod )

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

     i range(2, N+1) range 2 N+1 N 1 self.fact.append( (self.fact[-1]  * i) % mod ) self.fact.append self.fact self fact append (self.fact[-1]  * i) % mod self.fact[-1]  * i self.fact[-1] self.fact self fact -1 i mod self.inv .append( (-self.inv[mod%i] * (mod//i) ) % mod ) self.inv .append self.inv self inv append (-self.inv[mod%i] * (mod//i) ) % mod -self.inv[mod%i] * (mod//i) -self.inv[mod%i] self.inv[mod%i] self.inv self inv mod%i mod i mod//i mod i mod self.factinv.append( (self.factinv[-1] * self.inv[-1]) % mod ) self.factinv.append self.factinv self factinv append (self.factinv[-1] * self.inv[-1]) % mod self.factinv[-1] * self.inv[-1] self.factinv[-1] self.factinv self factinv -1 self.inv[-1] self.inv self inv -1 mod self self N=10**6 N 10**6 10 6 mod=10**9+7 mod 10**9+7 10**9 10 9 7 def nCr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        r = min(r, n-r)
        return self.fact[n]*self.factinv[r]*self.factinv[n-r] % self.mod

     nCr if ( r < 0 ) or ( n < r ) : return 0
         ( r < 0 ) or ( n < r ) r < 0 r 0 n < r n r r = min(r, n-r) r min(r, n-r) min r n-r n r return self.fact[n]*self.factinv[r]*self.factinv[n-r] % self.mod self.fact[n]*self.factinv[r]*self.factinv[n-r] % self.mod self.fact[n]*self.factinv[r]*self.factinv[n-r] self.fact[n]*self.factinv[r] self.fact[n] self.fact self fact n self.factinv[r] self.factinv self factinv r self.factinv[n-r] self.factinv self factinv n-r n r self.mod self mod self self n n r r def nPr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        return self.fact[n]*self.factinv[n-r] % self.mod nPr if ( r < 0 ) or ( n < r ) : return 0
         ( r < 0 ) or ( n < r ) r < 0 r 0 n < r n r return self.fact[n]*self.factinv[n-r] % self.mod self.fact[n]*self.factinv[n-r] % self.mod self.fact[n]*self.factinv[n-r] self.fact[n] self.fact self fact n self.factinv[n-r] self.factinv self factinv n-r n r self.mod self mod self self n n r r 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 comb = Combination(2*10**5+100) comb Combination(2*10**5+100) Combination 2*10**5+100 2*10**5 2 10**5 10 5 100 ans = 0 ans 0 for m in range(min(n+1,k+1)) :
    ans = ans%mod + (comb.nCr(n,m) * comb.nCr(n-1, n-m-1))%mod m range(min(n+1,k+1)) range min(n+1,k+1) min n+1 n 1 k+1 k 1 ans = ans%mod + (comb.nCr(n,m) * comb.nCr(n-1, n-m-1))%mod ans ans%mod + (comb.nCr(n,m) * comb.nCr(n-1, n-m-1))%mod ans%mod ans mod (comb.nCr(n,m) * comb.nCr(n-1, n-m-1))%mod comb.nCr(n,m) * comb.nCr(n-1, n-m-1) comb.nCr(n,m) comb.nCr comb nCr n m comb.nCr(n-1, n-m-1) comb.nCr comb nCr n-1 n 1 n-m-1 n-m n m 1 mod print(ans%mod) print ans%mod ans mod n, k = map(int, input().split()) map(int, input().split()) n comb = Combination(2*10**5+100) Combination(2*10**5+100) comb mod = 10**9+7 10**9+7 mod ans = 0 0 ans k = map(int, input().split()) map(int, input().split()) k class Combination : 
    def __init__ (self, N=10**6, mod=10**9+7) :
        self.mod = mod
        self.fact = [1, 1]
        self.factinv = [1, 1]
        self.inv = [0, 1]
        for i in range(2, N+1) :
            self.fact.append( (self.fact[-1]  * i) % mod )
            self.inv .append( (-self.inv[mod%i] * (mod//i) ) % mod )
            self.factinv.append( (self.factinv[-1] * self.inv[-1]) % mod )

    def nCr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        r = min(r, n-r)
        return self.fact[n]*self.factinv[r]*self.factinv[n-r] % self.mod

    def nPr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        return self.fact[n]*self.factinv[n-r] % self.mod class Combination : 
    def __init__ (self, N=10**6, mod=10**9+7) :
        self.mod = mod
        self.fact = [1, 1]
        self.factinv = [1, 1]
        self.inv = [0, 1]
        for i in range(2, N+1) :
            self.fact.append( (self.fact[-1]  * i) % mod )
            self.inv .append( (-self.inv[mod%i] * (mod//i) ) % mod )
            self.factinv.append( (self.factinv[-1] * self.inv[-1]) % mod )

    def nCr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        r = min(r, n-r)
        return self.fact[n]*self.factinv[r]*self.factinv[n-r] % self.mod

    def nPr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        return self.fact[n]*self.factinv[n-r] % self.mod Combination ans = ans%mod + (comb.nCr(n,m) * comb.nCr(n-1, n-m-1))%mod ans%mod + (comb.nCr(n,m) * comb.nCr(n-1, n-m-1))%mod ans

import numpy as np

class Combination : 
    def __init__ (self, N=10**6, mod=10**9+7) :
        self.mod = mod
        self.fact = [1, 1]
        self.factinv = [1, 1]
        self.inv = [0, 1]
        for i in range(2, N+1) :
            self.fact.append( (self.fact[-1]  * i) % mod )
            self.inv .append( (-self.inv[mod%i] * (mod//i) ) % mod )
            self.factinv.append( (self.factinv[-1] * self.inv[-1]) % mod )

    def nCr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        r = min(r, n-r)
        return self.fact[n]*self.factinv[r]*self.factinv[n-r] % self.mod

    def nPr(self, n, r) :
        if ( r < 0 ) or ( n < r ) : return 0
        return self.fact[n]*self.factinv[n-r] % self.mod


n, k = map(int, input().split())

mod = 10**9+7
comb = Combination(2*10**5+100)
ans = 0
for m in range(min(n+1,k+1)) :
    ans = ans%mod + (comb.nCr(n,m) * comb.nCr(n-1, n-m-1))%mod
print(ans%mod)
