MOD = 10**9 + 7
N = 10**6  # 10**6が限界
factorial_mod = [1, 1]  # factrial_mod[i] := i! mod p
modular_multiplicative_inverse = [0, 1]  # モジュラ逆数 := i^(-1) ≡ x (mod p) となるx
factorial_inverse_mod = [1, 1]  # factrial_inverse_mod[i] := (i!)^(-1) mod p

for i in range(2, N + 1):  # O(N)
    factorial_mod.append((factorial_mod[i - 1] * i) % MOD)
    modular_multiplicative_inverse.append((-modular_multiplicative_inverse[MOD % i] * (MOD // i)) % MOD)
    factorial_inverse_mod.append((factorial_inverse_mod[i-1] * modular_multiplicative_inverse[i]) % MOD)

def nCr_mod(n, r):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return factorial_mod[n] * factorial_inverse_mod[r] * factorial_inverse_mod[n - r] % MOD

def nPr_mod(n, r):
    return factorial_mod[n] * factorial_inverse_mod[n - r] % MOD

# ---------------------- #

n, k = (int(x) for x in input().split())
ans = 0
for i in range(min(n - 1, k) + 1):
    # nCi * n-iHi = nCi * n-1Ci
    ans += nCr_mod(n, i) * nCr_mod(n - 1, i)
    ans %= MOD
print(ans) MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 N = 10**6 N 10**6 10 6 factorial_mod = [1, 1] factorial_mod [1, 1] 1 1 modular_multiplicative_inverse = [0, 1] modular_multiplicative_inverse [0, 1] 0 1 factorial_inverse_mod = [1, 1] factorial_inverse_mod [1, 1] 1 1 for i in range(2, N + 1):  # O(N)
    factorial_mod.append((factorial_mod[i - 1] * i) % MOD)
    modular_multiplicative_inverse.append((-modular_multiplicative_inverse[MOD % i] * (MOD // i)) % MOD)
    factorial_inverse_mod.append((factorial_inverse_mod[i-1] * modular_multiplicative_inverse[i]) % MOD) i range(2, N + 1) range 2 N + 1 N 1 factorial_mod.append((factorial_mod[i - 1] * i) % MOD) factorial_mod.append factorial_mod append (factorial_mod[i - 1] * i) % MOD factorial_mod[i - 1] * i factorial_mod[i - 1] factorial_mod i - 1 i 1 i MOD modular_multiplicative_inverse.append((-modular_multiplicative_inverse[MOD % i] * (MOD // i)) % MOD) modular_multiplicative_inverse.append modular_multiplicative_inverse append (-modular_multiplicative_inverse[MOD % i] * (MOD // i)) % MOD -modular_multiplicative_inverse[MOD % i] * (MOD // i) -modular_multiplicative_inverse[MOD % i] modular_multiplicative_inverse[MOD % i] modular_multiplicative_inverse MOD % i MOD i MOD // i MOD i MOD factorial_inverse_mod.append((factorial_inverse_mod[i-1] * modular_multiplicative_inverse[i]) % MOD) factorial_inverse_mod.append factorial_inverse_mod append (factorial_inverse_mod[i-1] * modular_multiplicative_inverse[i]) % MOD factorial_inverse_mod[i-1] * modular_multiplicative_inverse[i] factorial_inverse_mod[i-1] factorial_inverse_mod i-1 i 1 modular_multiplicative_inverse[i] modular_multiplicative_inverse i MOD def nCr_mod(n, r):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return factorial_mod[n] * factorial_inverse_mod[r] * factorial_inverse_mod[n - r] % MOD nCr_mod if r < 0 or r > n:
        return 0
     r < 0 or r > n r < 0 r 0 r > n r n return 0 0 r = min(r, n - r) r min(r, n - r) min r n - r n r return factorial_mod[n] * factorial_inverse_mod[r] * factorial_inverse_mod[n - r] % MOD factorial_mod[n] * factorial_inverse_mod[r] * factorial_inverse_mod[n - r] % MOD factorial_mod[n] * factorial_inverse_mod[r] * factorial_inverse_mod[n - r] factorial_mod[n] * factorial_inverse_mod[r] factorial_mod[n] factorial_mod n factorial_inverse_mod[r] factorial_inverse_mod r factorial_inverse_mod[n - r] factorial_inverse_mod n - r n r MOD n n r r def nPr_mod(n, r):
    return factorial_mod[n] * factorial_inverse_mod[n - r] % MOD

# ---------------------- # nPr_mod return factorial_mod[n] * factorial_inverse_mod[n - r] % MOD factorial_mod[n] * factorial_inverse_mod[n - r] % MOD factorial_mod[n] * factorial_inverse_mod[n - r] factorial_mod[n] factorial_mod n factorial_inverse_mod[n - r] factorial_inverse_mod n - r n r MOD n n r r int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x n, k = (int(x) for x in input().split()) n (int(x) for x in input().split()) k ans = 0 ans 0 for i in range(min(n - 1, k) + 1):
    # nCi * n-iHi = nCi * n-1Ci
    ans += nCr_mod(n, i) * nCr_mod(n - 1, i)
    ans %= MOD i range(min(n - 1, k) + 1) range min(n - 1, k) + 1 min(n - 1, k) min n - 1 n 1 k 1 ans += nCr_mod(n, i) * nCr_mod(n - 1, i) ans nCr_mod(n, i) * nCr_mod(n - 1, i) nCr_mod(n, i) nCr_mod n i nCr_mod(n - 1, i) nCr_mod n - 1 n 1 i ans %= MOD ans MOD print(ans) print ans factorial_mod = [1, 1] [1, 1] factorial_mod modular_multiplicative_inverse = [0, 1] [0, 1] modular_multiplicative_inverse def nCr_mod(n, r):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return factorial_mod[n] * factorial_inverse_mod[r] * factorial_inverse_mod[n - r] % MOD def nCr_mod(n, r):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return factorial_mod[n] * factorial_inverse_mod[r] * factorial_inverse_mod[n - r] % MOD nCr_mod ans %= MOD MOD ans def nPr_mod(n, r):
    return factorial_mod[n] * factorial_inverse_mod[n - r] % MOD

# ---------------------- # def nPr_mod(n, r):
    return factorial_mod[n] * factorial_inverse_mod[n - r] % MOD

# ---------------------- # nPr_mod k = (int(x) for x in input().split()) (int(x) for x in input().split()) k n, k = (int(x) for x in input().split()) (int(x) for x in input().split()) n MOD = 10**9 + 7 10**9 + 7 MOD ans += nCr_mod(n, i) * nCr_mod(n - 1, i) nCr_mod(n, i) * nCr_mod(n - 1, i) ans ans = 0 0 ans N = 10**6 10**6 N factorial_inverse_mod = [1, 1] [1, 1] factorial_inverse_mod
MOD = 10**9 + 7
N = 10**6  # 10**6が限界
factorial_mod = [1, 1]  # factrial_mod[i] := i! mod p
modular_multiplicative_inverse = [0, 1]  # モジュラ逆数 := i^(-1) ≡ x (mod p) となるx
factorial_inverse_mod = [1, 1]  # factrial_inverse_mod[i] := (i!)^(-1) mod p

for i in range(2, N + 1):  # O(N)
    factorial_mod.append((factorial_mod[i - 1] * i) % MOD)
    modular_multiplicative_inverse.append((-modular_multiplicative_inverse[MOD % i] * (MOD // i)) % MOD)
    factorial_inverse_mod.append((factorial_inverse_mod[i-1] * modular_multiplicative_inverse[i]) % MOD)

def nCr_mod(n, r):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return factorial_mod[n] * factorial_inverse_mod[r] * factorial_inverse_mod[n - r] % MOD

def nPr_mod(n, r):
    return factorial_mod[n] * factorial_inverse_mod[n - r] % MOD

# ---------------------- #

n, k = (int(x) for x in input().split())
ans = 0
for i in range(min(n - 1, k) + 1):
    # nCi * n-iHi = nCi * n-1Ci
    ans += nCr_mod(n, i) * nCr_mod(n - 1, i)
    ans %= MOD
print(ans)
