from itertools import accumulate
import numpy as np
MOD = 10 ** 9 + 7


def cumprod(A, mod=MOD):
    L = len(A)
    Lsq = int(L ** 0.5 + 1)
    A = np.resize(A, Lsq ** 2).reshape((Lsq, Lsq))
    for i in range(1, Lsq):
        A[:, i] *= A[:, i - 1]
        A[:, i] %= mod
    for i in range(1, Lsq):
        A[i] *= A[i - 1][-1]
        A[i] %= mod
    return A.ravel()[:L]


def make_fact_and_inv(U, mod=MOD):
    """
    0~Nまでのサイズ(N+1)の階乗およびその逆元の配列を返す
    """
    tmp = np.arange(U, dtype=np.int64)
    tmp[0] = 1
    fact = cumprod(tmp, mod)
    tmp = np.arange(U, 0, -1, dtype=np.int64)
    tmp[0] = pow(int(fact[-1]), mod - 2, mod)
    inv = cumprod(tmp, mod)[::-1]
    return fact, inv


fact, inv = make_fact_and_inv(2 * 10 ** 5 + 10)


def nCr(n, r, mod=MOD):
    if r < 0 or r > n or n < 0:
        return 0
    return fact[n] * inv[r] % mod * inv[n - r] % mod


if __name__ == "__main__":
    N, K = map(int, input().split())

    ans = []
    for i in range(min(N - 1, K) + 1):
        val = nCr(N, i) * nCr(N - 1, i) % MOD
        ans.append(val)

    answer = 0
    while ans:
        answer = (answer + ans.pop()) % MOD
    print(answer) from itertools import accumulate import numpy as np numpy MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 def cumprod(A, mod=MOD):
    L = len(A)
    Lsq = int(L ** 0.5 + 1)
    A = np.resize(A, Lsq ** 2).reshape((Lsq, Lsq))
    for i in range(1, Lsq):
        A[:, i] *= A[:, i - 1]
        A[:, i] %= mod
    for i in range(1, Lsq):
        A[i] *= A[i - 1][-1]
        A[i] %= mod
    return A.ravel()[:L] cumprod L = len(A) L len(A) len A Lsq = int(L ** 0.5 + 1) Lsq int(L ** 0.5 + 1) int L ** 0.5 + 1 L ** 0.5 L 0.5 1 A = np.resize(A, Lsq ** 2).reshape((Lsq, Lsq)) A np.resize(A, Lsq ** 2).reshape((Lsq, Lsq)) np.resize(A, Lsq ** 2).reshape np.resize(A, Lsq ** 2) np.resize np resize A Lsq ** 2 Lsq 2 reshape (Lsq, Lsq) Lsq Lsq for i in range(1, Lsq):
        A[:, i] *= A[:, i - 1]
        A[:, i] %= mod
     i range(1, Lsq) range 1 Lsq A[:, i] *= A[:, i - 1] A[:, i] A : A[:, i - 1] A : A[:, i] %= mod A[:, i] A : mod for i in range(1, Lsq):
        A[i] *= A[i - 1][-1]
        A[i] %= mod
     i range(1, Lsq) range 1 Lsq A[i] *= A[i - 1][-1] A[i] A i A[i - 1][-1] [i - 1] A i - 1 i 1 -1 A[i] %= mod A[i] A i mod return A.ravel()[:L] A.ravel()[:L] A.ravel() A.ravel A ravel :L L A A mod=MOD mod MOD def make_fact_and_inv(U, mod=MOD):
    """
    0~Nまでのサイズ(N+1)の階乗およびその逆元の配列を返す
    """
    tmp = np.arange(U, dtype=np.int64)
    tmp[0] = 1
    fact = cumprod(tmp, mod)
    tmp = np.arange(U, 0, -1, dtype=np.int64)
    tmp[0] = pow(int(fact[-1]), mod - 2, mod)
    inv = cumprod(tmp, mod)[::-1]
    return fact, inv make_fact_and_inv """
    0~Nまでのサイズ(N+1)の階乗およびその逆元の配列を返す
    """ tmp = np.arange(U, dtype=np.int64) tmp np.arange(U, dtype=np.int64) np.arange np arange U dtype=np.int64 dtype np.int64 np int64 tmp[0] = 1 tmp[0] tmp 0 1 fact = cumprod(tmp, mod) fact cumprod(tmp, mod) cumprod tmp mod tmp = np.arange(U, 0, -1, dtype=np.int64) tmp np.arange(U, 0, -1, dtype=np.int64) np.arange np arange U 0 -1 dtype=np.int64 dtype np.int64 np int64 tmp[0] = pow(int(fact[-1]), mod - 2, mod) tmp[0] tmp 0 pow(int(fact[-1]), mod - 2, mod) pow int(fact[-1]) int fact[-1] fact -1 mod - 2 mod 2 mod inv = cumprod(tmp, mod)[::-1] inv cumprod(tmp, mod)[::-1] (tmp, mod) cumprod tmp mod ::-1 -1 return fact, inv return fact, inv fact inv U U mod=MOD mod MOD fact, inv = make_fact_and_inv(2 * 10 ** 5 + 10) fact make_fact_and_inv(2 * 10 ** 5 + 10) make_fact_and_inv 2 * 10 ** 5 + 10 2 * 10 ** 5 2 10 ** 5 10 5 10 inv def nCr(n, r, mod=MOD):
    if r < 0 or r > n or n < 0:
        return 0
    return fact[n] * inv[r] % mod * inv[n - r] % mod nCr if r < 0 or r > n or n < 0:
        return 0
     r < 0 or r > n or n < 0 r < 0 or r > n r < 0 r 0 r > n r n n < 0 n 0 return 0 0 return fact[n] * inv[r] % mod * inv[n - r] % mod fact[n] * inv[r] % mod * inv[n - r] % mod fact[n] * inv[r] % mod * inv[n - r] fact[n] * inv[r] % mod fact[n] * inv[r] fact[n] fact n inv[r] inv r mod inv[n - r] inv n - r n r mod n n r r mod=MOD mod MOD if __name__ == "__main__":
    N, K = map(int, input().split())

    ans = []
    for i in range(min(N - 1, K) + 1):
        val = nCr(N, i) * nCr(N - 1, i) % MOD
        ans.append(val)

    answer = 0
    while ans:
        answer = (answer + ans.pop()) % MOD
    print(answer) __name__ == "__main__" __name__ "__main__" N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K ans = [] ans [] for i in range(min(N - 1, K) + 1):
        val = nCr(N, i) * nCr(N - 1, i) % MOD
        ans.append(val)

     i range(min(N - 1, K) + 1) range min(N - 1, K) + 1 min(N - 1, K) min N - 1 N 1 K 1 val = nCr(N, i) * nCr(N - 1, i) % MOD val nCr(N, i) * nCr(N - 1, i) % MOD nCr(N, i) * nCr(N - 1, i) nCr(N, i) nCr N i nCr(N - 1, i) nCr N - 1 N 1 i MOD ans.append(val) ans.append ans append val answer = 0 answer 0 while ans:
        answer = (answer + ans.pop()) % MOD
     ans answer = (answer + ans.pop()) % MOD answer (answer + ans.pop()) % MOD answer + ans.pop() answer ans.pop() ans.pop ans pop MOD print(answer) print answer def nCr(n, r, mod=MOD):
    if r < 0 or r > n or n < 0:
        return 0
    return fact[n] * inv[r] % mod * inv[n - r] % mod def nCr(n, r, mod=MOD):
    if r < 0 or r > n or n < 0:
        return 0
    return fact[n] * inv[r] % mod * inv[n - r] % mod nCr N, K = map(int, input().split()) map(int, input().split()) N def make_fact_and_inv(U, mod=MOD):
    """
    0~Nまでのサイズ(N+1)の階乗およびその逆元の配列を返す
    """
    tmp = np.arange(U, dtype=np.int64)
    tmp[0] = 1
    fact = cumprod(tmp, mod)
    tmp = np.arange(U, 0, -1, dtype=np.int64)
    tmp[0] = pow(int(fact[-1]), mod - 2, mod)
    inv = cumprod(tmp, mod)[::-1]
    return fact, inv def make_fact_and_inv(U, mod=MOD):
    """
    0~Nまでのサイズ(N+1)の階乗およびその逆元の配列を返す
    """
    tmp = np.arange(U, dtype=np.int64)
    tmp[0] = 1
    fact = cumprod(tmp, mod)
    tmp = np.arange(U, 0, -1, dtype=np.int64)
    tmp[0] = pow(int(fact[-1]), mod - 2, mod)
    inv = cumprod(tmp, mod)[::-1]
    return fact, inv make_fact_and_inv answer = (answer + ans.pop()) % MOD (answer + ans.pop()) % MOD answer inv = make_fact_and_inv(2 * 10 ** 5 + 10) make_fact_and_inv(2 * 10 ** 5 + 10) inv ans = [] [] ans K = map(int, input().split()) map(int, input().split()) K answer = 0 0 answer def cumprod(A, mod=MOD):
    L = len(A)
    Lsq = int(L ** 0.5 + 1)
    A = np.resize(A, Lsq ** 2).reshape((Lsq, Lsq))
    for i in range(1, Lsq):
        A[:, i] *= A[:, i - 1]
        A[:, i] %= mod
    for i in range(1, Lsq):
        A[i] *= A[i - 1][-1]
        A[i] %= mod
    return A.ravel()[:L] def cumprod(A, mod=MOD):
    L = len(A)
    Lsq = int(L ** 0.5 + 1)
    A = np.resize(A, Lsq ** 2).reshape((Lsq, Lsq))
    for i in range(1, Lsq):
        A[:, i] *= A[:, i - 1]
        A[:, i] %= mod
    for i in range(1, Lsq):
        A[i] *= A[i - 1][-1]
        A[i] %= mod
    return A.ravel()[:L] cumprod MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD fact, inv = make_fact_and_inv(2 * 10 ** 5 + 10) make_fact_and_inv(2 * 10 ** 5 + 10) fact val = nCr(N, i) * nCr(N - 1, i) % MOD nCr(N, i) * nCr(N - 1, i) % MOD val
from itertools import accumulate
import numpy as np
MOD = 10 ** 9 + 7


def cumprod(A, mod=MOD):
    L = len(A)
    Lsq = int(L ** 0.5 + 1)
    A = np.resize(A, Lsq ** 2).reshape((Lsq, Lsq))
    for i in range(1, Lsq):
        A[:, i] *= A[:, i - 1]
        A[:, i] %= mod
    for i in range(1, Lsq):
        A[i] *= A[i - 1][-1]
        A[i] %= mod
    return A.ravel()[:L]


def make_fact_and_inv(U, mod=MOD):
    """
    0~Nまでのサイズ(N+1)の階乗およびその逆元の配列を返す
    """
    tmp = np.arange(U, dtype=np.int64)
    tmp[0] = 1
    fact = cumprod(tmp, mod)
    tmp = np.arange(U, 0, -1, dtype=np.int64)
    tmp[0] = pow(int(fact[-1]), mod - 2, mod)
    inv = cumprod(tmp, mod)[::-1]
    return fact, inv


fact, inv = make_fact_and_inv(2 * 10 ** 5 + 10)


def nCr(n, r, mod=MOD):
    if r < 0 or r > n or n < 0:
        return 0
    return fact[n] * inv[r] % mod * inv[n - r] % mod


if __name__ == "__main__":
    N, K = map(int, input().split())

    ans = []
    for i in range(min(N - 1, K) + 1):
        val = nCr(N, i) * nCr(N - 1, i) % MOD
        ans.append(val)

    answer = 0
    while ans:
        answer = (answer + ans.pop()) % MOD
    print(answer)
