### BUGGY CODE ###


import numpy as np

MOD = int(1e9+7)

class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )

premax = int(200020)
mymodflag = False
f, rf = np.zeros(premax, dtype=ModInt), np.zeros(premax, dtype=ModInt)
def nCk(n, k) :
    global mymodflag, r, rf, premax
    if ( n == k ) : return ModInt(0)
    if ( not mymodflag ) : 
        f[0] = ModInt(1)
        for i in range(1,premax) : f[i] = f[i-1]*ModInt(i)
        rf[premax-1] = pow(f[premax-1], MOD-2)
        for i in range(premax-2, -1, -1) : rf[i] = rf[i+1]*ModInt(i+1)
        mymodflag = True
    return f[n]*rf[n-k]*rf[k]

def nPk(n, k) :
    global mymodflag, r, rf, premax
    if ( n == k ) : return ModInt(0)
    if ( not mymodflag ) : 
        f[0] = ModInt(1)
        for i in range(1,premax) : f[i] = f[i-1]*ModInt(i)
        rf[premax-1] = pow(f[premax-1], MOD-2)
        for i in range(premax-2, -1, -1) : rf[i] = rf[i+1]*ModInt(i+1)
        mymodflag = True
    return f[n]*rf[n-k]


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

ans = ModInt(0)
for m in range(0, min(n,k+1)) :
    ans += nCk(n,m)*nCk(n-1, n-m-1)

print(ans+1)


### FIXED CODE ###


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)