n, k = map(int, input().strip().split())
k=min(k,n-1)
MOD=10**9+7

# a*a**(p-2) mod p (Fermat's little theorem)
def modInv(x,m=10**9+7):
    return pow(x,m-2,m)

class combMod:
    def __init__(self,maxN,mod=10**9+7):
        self.maxN=maxN
        self.mod=mod
        self.fac=[None]*(maxN+1) # fac[0]=1, fac[1]=1, fac[2]=2 ... fac[maxN]
        self.ifac=[None]*(maxN+1)
        # self.ifac[0]=1
        
    def calc_fact(self): # make the table
        self.fac[0]=1
        for i in range(1,self.maxN+1):
            self.fac[i] = self.fac[i-1]*i % self.mod
        self.ifac[-1] = modInv(self.fac[-1])
        for i in range(self.maxN,0,-1):
            self.ifac[i-1] = self.ifac[i]*i % self.mod
    def modnCr(self,n, r,mod=None):
        if mod is None:
            mod=self.mod
        denom = self.fac[n]
        numer = self.ifac[r] * self.ifac[n-r] % mod
        return  denom * numer % mod

combMod=combMod(2*n+1)
combMod.calc_fact()
ans=0
for ki in range(k+1):
    ans += combMod.modnCr(n, ki)*combMod.modnCr(n-ki-1+ki, ki)%MOD
print(ans%MOD) n, k = map(int, input().strip().split()) n map(int, input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split k k=min(k,n-1) k min(k,n-1) min k n-1 n 1 MOD=10**9+7 MOD 10**9+7 10**9 10 9 7 def modInv(x,m=10**9+7):
    return pow(x,m-2,m) modInv return pow(x,m-2,m) pow(x,m-2,m) pow x m-2 m 2 m x x m=10**9+7 m 10**9+7 10**9 10 9 7 class combMod:
    def __init__(self,maxN,mod=10**9+7):
        self.maxN=maxN
        self.mod=mod
        self.fac=[None]*(maxN+1) # fac[0]=1, fac[1]=1, fac[2]=2 ... fac[maxN]
        self.ifac=[None]*(maxN+1)
        # self.ifac[0]=1
        
    def calc_fact(self): # make the table
        self.fac[0]=1
        for i in range(1,self.maxN+1):
            self.fac[i] = self.fac[i-1]*i % self.mod
        self.ifac[-1] = modInv(self.fac[-1])
        for i in range(self.maxN,0,-1):
            self.ifac[i-1] = self.ifac[i]*i % self.mod
    def modnCr(self,n, r,mod=None):
        if mod is None:
            mod=self.mod
        denom = self.fac[n]
        numer = self.ifac[r] * self.ifac[n-r] % mod
        return  denom * numer % mod combMod def __init__(self,maxN,mod=10**9+7):
        self.maxN=maxN
        self.mod=mod
        self.fac=[None]*(maxN+1) # fac[0]=1, fac[1]=1, fac[2]=2 ... fac[maxN]
        self.ifac=[None]*(maxN+1)
        # self.ifac[0]=1
        
     __init__ self.maxN=maxN self.maxN self maxN maxN self.mod=mod self.mod self mod mod self.fac=[None]*(maxN+1) self.fac self fac [None]*(maxN+1) [None] None maxN+1 maxN 1 self.ifac=[None]*(maxN+1) self.ifac self ifac [None]*(maxN+1) [None] None maxN+1 maxN 1 self self maxN maxN mod=10**9+7 mod 10**9+7 10**9 10 9 7 def calc_fact(self): # make the table
        self.fac[0]=1
        for i in range(1,self.maxN+1):
            self.fac[i] = self.fac[i-1]*i % self.mod
        self.ifac[-1] = modInv(self.fac[-1])
        for i in range(self.maxN,0,-1):
            self.ifac[i-1] = self.ifac[i]*i % self.mod
     calc_fact self.fac[0]=1 self.fac[0] self.fac self fac 0 1 for i in range(1,self.maxN+1):
            self.fac[i] = self.fac[i-1]*i % self.mod
         i range(1,self.maxN+1) range 1 self.maxN+1 self.maxN self maxN 1 self.fac[i] = self.fac[i-1]*i % self.mod self.fac[i] self.fac self fac i self.fac[i-1]*i % self.mod self.fac[i-1]*i self.fac[i-1] self.fac self fac i-1 i 1 i self.mod self mod self.ifac[-1] = modInv(self.fac[-1]) self.ifac[-1] self.ifac self ifac -1 modInv(self.fac[-1]) modInv self.fac[-1] self.fac self fac -1 for i in range(self.maxN,0,-1):
            self.ifac[i-1] = self.ifac[i]*i % self.mod
     i range(self.maxN,0,-1) range self.maxN self maxN 0 -1 self.ifac[i-1] = self.ifac[i]*i % self.mod self.ifac[i-1] self.ifac self ifac i-1 i 1 self.ifac[i]*i % self.mod self.ifac[i]*i self.ifac[i] self.ifac self ifac i i self.mod self mod self self def modnCr(self,n, r,mod=None):
        if mod is None:
            mod=self.mod
        denom = self.fac[n]
        numer = self.ifac[r] * self.ifac[n-r] % mod
        return  denom * numer % mod modnCr if mod is None:
            mod=self.mod
         mod is None mod None mod=self.mod mod self.mod self mod denom = self.fac[n] denom self.fac[n] self.fac self fac n numer = self.ifac[r] * self.ifac[n-r] % mod numer self.ifac[r] * self.ifac[n-r] % mod self.ifac[r] * self.ifac[n-r] self.ifac[r] self.ifac self ifac r self.ifac[n-r] self.ifac self ifac n-r n r mod return  denom * numer % mod denom * numer % mod denom * numer denom numer mod self self n n r r mod=None mod None combMod=combMod(2*n+1) combMod combMod(2*n+1) combMod 2*n+1 2*n 2 n 1 combMod.calc_fact() combMod.calc_fact combMod calc_fact ans=0 ans 0 for ki in range(k+1):
    ans += combMod.modnCr(n, ki)*combMod.modnCr(n-ki-1+ki, ki)%MOD ki range(k+1) range k+1 k 1 ans += combMod.modnCr(n, ki)*combMod.modnCr(n-ki-1+ki, ki)%MOD ans combMod.modnCr(n, ki)*combMod.modnCr(n-ki-1+ki, ki)%MOD combMod.modnCr(n, ki)*combMod.modnCr(n-ki-1+ki, ki) combMod.modnCr(n, ki) combMod.modnCr combMod modnCr n ki combMod.modnCr(n-ki-1+ki, ki) combMod.modnCr combMod modnCr n-ki-1+ki n-ki-1 n-ki n ki 1 ki ki MOD print(ans%MOD) print ans%MOD ans MOD MOD=10**9+7 10**9+7 MOD combMod=combMod(2*n+1) combMod(2*n+1) combMod ans=0 0 ans ans += combMod.modnCr(n, ki)*combMod.modnCr(n-ki-1+ki, ki)%MOD combMod.modnCr(n, ki)*combMod.modnCr(n-ki-1+ki, ki)%MOD ans n, k = map(int, input().strip().split()) map(int, input().strip().split()) n k = map(int, input().strip().split()) map(int, input().strip().split()) k class combMod:
    def __init__(self,maxN,mod=10**9+7):
        self.maxN=maxN
        self.mod=mod
        self.fac=[None]*(maxN+1) # fac[0]=1, fac[1]=1, fac[2]=2 ... fac[maxN]
        self.ifac=[None]*(maxN+1)
        # self.ifac[0]=1
        
    def calc_fact(self): # make the table
        self.fac[0]=1
        for i in range(1,self.maxN+1):
            self.fac[i] = self.fac[i-1]*i % self.mod
        self.ifac[-1] = modInv(self.fac[-1])
        for i in range(self.maxN,0,-1):
            self.ifac[i-1] = self.ifac[i]*i % self.mod
    def modnCr(self,n, r,mod=None):
        if mod is None:
            mod=self.mod
        denom = self.fac[n]
        numer = self.ifac[r] * self.ifac[n-r] % mod
        return  denom * numer % mod class combMod:
    def __init__(self,maxN,mod=10**9+7):
        self.maxN=maxN
        self.mod=mod
        self.fac=[None]*(maxN+1) # fac[0]=1, fac[1]=1, fac[2]=2 ... fac[maxN]
        self.ifac=[None]*(maxN+1)
        # self.ifac[0]=1
        
    def calc_fact(self): # make the table
        self.fac[0]=1
        for i in range(1,self.maxN+1):
            self.fac[i] = self.fac[i-1]*i % self.mod
        self.ifac[-1] = modInv(self.fac[-1])
        for i in range(self.maxN,0,-1):
            self.ifac[i-1] = self.ifac[i]*i % self.mod
    def modnCr(self,n, r,mod=None):
        if mod is None:
            mod=self.mod
        denom = self.fac[n]
        numer = self.ifac[r] * self.ifac[n-r] % mod
        return  denom * numer % mod combMod k=min(k,n-1) min(k,n-1) k def modInv(x,m=10**9+7):
    return pow(x,m-2,m) def modInv(x,m=10**9+7):
    return pow(x,m-2,m) modInv
n, k = map(int, input().strip().split())
k=min(k,n-1)
MOD=10**9+7

# a*a**(p-2) mod p (Fermat's little theorem)
def modInv(x,m=10**9+7):
    return pow(x,m-2,m)

class combMod:
    def __init__(self,maxN,mod=10**9+7):
        self.maxN=maxN
        self.mod=mod
        self.fac=[None]*(maxN+1) # fac[0]=1, fac[1]=1, fac[2]=2 ... fac[maxN]
        self.ifac=[None]*(maxN+1)
        # self.ifac[0]=1
        
    def calc_fact(self): # make the table
        self.fac[0]=1
        for i in range(1,self.maxN+1):
            self.fac[i] = self.fac[i-1]*i % self.mod
        self.ifac[-1] = modInv(self.fac[-1])
        for i in range(self.maxN,0,-1):
            self.ifac[i-1] = self.ifac[i]*i % self.mod
    def modnCr(self,n, r,mod=None):
        if mod is None:
            mod=self.mod
        denom = self.fac[n]
        numer = self.ifac[r] * self.ifac[n-r] % mod
        return  denom * numer % mod

combMod=combMod(2*n+1)
combMod.calc_fact()
ans=0
for ki in range(k+1):
    ans += combMod.modnCr(n, ki)*combMod.modnCr(n-ki-1+ki, ki)%MOD
print(ans%MOD)