from itertools import accumulate


class Combination:
    def __init__(self, N, MOD=10 ** 9 + 7):
        self.MOD = MOD
        self.fact, self.inv = self._make_factorial_list(N)

    def __call__(self, n, k):
        if k < 0 or k > n:
            return 0
        res = self.fact[n] * self.inv[k] % self.MOD
        res = res * self.inv[n - k] % self.MOD
        return res

    def _make_factorial_list(self, N):
        fact = [1] * (N + 1)
        inv = [1] * (N + 1)
        MOD = self.MOD
        for i in range(1, N + 1):
            fact[i] = (fact[i - 1] * i) % MOD
        inv[N] = pow(fact[N], MOD - 2, MOD)
        for i in range(N, 0, -1):
            inv[i - 1] = (inv[i] * i) % MOD
        return fact, inv


if __name__ == "__main__":
    N, K = map(int, input().split())
    MOD = 10**9+7
    comb = Combination(2*10**5+5, MOD)

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

    answer = 0
    while ans:
        answer = (answer + ans.pop()) % MOD
    print(answer) from itertools import accumulate class Combination:
    def __init__(self, N, MOD=10 ** 9 + 7):
        self.MOD = MOD
        self.fact, self.inv = self._make_factorial_list(N)

    def __call__(self, n, k):
        if k < 0 or k > n:
            return 0
        res = self.fact[n] * self.inv[k] % self.MOD
        res = res * self.inv[n - k] % self.MOD
        return res

    def _make_factorial_list(self, N):
        fact = [1] * (N + 1)
        inv = [1] * (N + 1)
        MOD = self.MOD
        for i in range(1, N + 1):
            fact[i] = (fact[i - 1] * i) % MOD
        inv[N] = pow(fact[N], MOD - 2, MOD)
        for i in range(N, 0, -1):
            inv[i - 1] = (inv[i] * i) % MOD
        return fact, inv Combination def __init__(self, N, MOD=10 ** 9 + 7):
        self.MOD = MOD
        self.fact, self.inv = self._make_factorial_list(N)

     __init__ self.MOD = MOD self.MOD self MOD MOD self.fact, self.inv = self._make_factorial_list(N) self.fact self fact self._make_factorial_list(N) self._make_factorial_list self _make_factorial_list N self.inv self inv self self N N MOD=10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 def __call__(self, n, k):
        if k < 0 or k > n:
            return 0
        res = self.fact[n] * self.inv[k] % self.MOD
        res = res * self.inv[n - k] % self.MOD
        return res

     __call__ if k < 0 or k > n:
            return 0
         k < 0 or k > n k < 0 k 0 k > n k n return 0 0 res = self.fact[n] * self.inv[k] % self.MOD res self.fact[n] * self.inv[k] % self.MOD self.fact[n] * self.inv[k] self.fact[n] self.fact self fact n self.inv[k] self.inv self inv k self.MOD self MOD res = res * self.inv[n - k] % self.MOD res res * self.inv[n - k] % self.MOD res * self.inv[n - k] res self.inv[n - k] self.inv self inv n - k n k self.MOD self MOD return res res self self n n k k def _make_factorial_list(self, N):
        fact = [1] * (N + 1)
        inv = [1] * (N + 1)
        MOD = self.MOD
        for i in range(1, N + 1):
            fact[i] = (fact[i - 1] * i) % MOD
        inv[N] = pow(fact[N], MOD - 2, MOD)
        for i in range(N, 0, -1):
            inv[i - 1] = (inv[i] * i) % MOD
        return fact, inv _make_factorial_list fact = [1] * (N + 1) fact [1] * (N + 1) [1] 1 N + 1 N 1 inv = [1] * (N + 1) inv [1] * (N + 1) [1] 1 N + 1 N 1 MOD = self.MOD MOD self.MOD self MOD for i in range(1, N + 1):
            fact[i] = (fact[i - 1] * i) % MOD
         i range(1, N + 1) range 1 N + 1 N 1 fact[i] = (fact[i - 1] * i) % MOD fact[i] fact i (fact[i - 1] * i) % MOD fact[i - 1] * i fact[i - 1] fact i - 1 i 1 i MOD inv[N] = pow(fact[N], MOD - 2, MOD) inv[N] inv N pow(fact[N], MOD - 2, MOD) pow fact[N] fact N MOD - 2 MOD 2 MOD for i in range(N, 0, -1):
            inv[i - 1] = (inv[i] * i) % MOD
         i range(N, 0, -1) range N 0 -1 inv[i - 1] = (inv[i] * i) % MOD inv[i - 1] inv i - 1 i 1 (inv[i] * i) % MOD inv[i] * i inv[i] inv i i MOD return fact, inv return fact, inv fact inv self self N N if __name__ == "__main__":
    N, K = map(int, input().split())
    MOD = 10**9+7
    comb = Combination(2*10**5+5, MOD)

    ans = []
    for i in range(min(N - 1, K) + 1):
        val = comb(N, i) * comb(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 MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 comb = Combination(2*10**5+5, MOD) comb Combination(2*10**5+5, MOD) Combination 2*10**5+5 2*10**5 2 10**5 10 5 5 MOD ans = [] ans [] for i in range(min(N - 1, K) + 1):
        val = comb(N, i) * comb(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 = comb(N, i) * comb(N - 1, i) % MOD val comb(N, i) * comb(N - 1, i) % MOD comb(N, i) * comb(N - 1, i) comb(N, i) comb N i comb(N - 1, i) comb 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 val = comb(N, i) * comb(N - 1, i) % MOD comb(N, i) * comb(N - 1, i) % MOD val answer = (answer + ans.pop()) % MOD (answer + ans.pop()) % MOD answer N, K = map(int, input().split()) map(int, input().split()) N ans = [] [] ans comb = Combination(2*10**5+5, MOD) Combination(2*10**5+5, MOD) comb class Combination:
    def __init__(self, N, MOD=10 ** 9 + 7):
        self.MOD = MOD
        self.fact, self.inv = self._make_factorial_list(N)

    def __call__(self, n, k):
        if k < 0 or k > n:
            return 0
        res = self.fact[n] * self.inv[k] % self.MOD
        res = res * self.inv[n - k] % self.MOD
        return res

    def _make_factorial_list(self, N):
        fact = [1] * (N + 1)
        inv = [1] * (N + 1)
        MOD = self.MOD
        for i in range(1, N + 1):
            fact[i] = (fact[i - 1] * i) % MOD
        inv[N] = pow(fact[N], MOD - 2, MOD)
        for i in range(N, 0, -1):
            inv[i - 1] = (inv[i] * i) % MOD
        return fact, inv class Combination:
    def __init__(self, N, MOD=10 ** 9 + 7):
        self.MOD = MOD
        self.fact, self.inv = self._make_factorial_list(N)

    def __call__(self, n, k):
        if k < 0 or k > n:
            return 0
        res = self.fact[n] * self.inv[k] % self.MOD
        res = res * self.inv[n - k] % self.MOD
        return res

    def _make_factorial_list(self, N):
        fact = [1] * (N + 1)
        inv = [1] * (N + 1)
        MOD = self.MOD
        for i in range(1, N + 1):
            fact[i] = (fact[i - 1] * i) % MOD
        inv[N] = pow(fact[N], MOD - 2, MOD)
        for i in range(N, 0, -1):
            inv[i - 1] = (inv[i] * i) % MOD
        return fact, inv Combination K = map(int, input().split()) map(int, input().split()) K MOD = 10**9+7 10**9+7 MOD answer = 0 0 answer
from itertools import accumulate


class Combination:
    def __init__(self, N, MOD=10 ** 9 + 7):
        self.MOD = MOD
        self.fact, self.inv = self._make_factorial_list(N)

    def __call__(self, n, k):
        if k < 0 or k > n:
            return 0
        res = self.fact[n] * self.inv[k] % self.MOD
        res = res * self.inv[n - k] % self.MOD
        return res

    def _make_factorial_list(self, N):
        fact = [1] * (N + 1)
        inv = [1] * (N + 1)
        MOD = self.MOD
        for i in range(1, N + 1):
            fact[i] = (fact[i - 1] * i) % MOD
        inv[N] = pow(fact[N], MOD - 2, MOD)
        for i in range(N, 0, -1):
            inv[i - 1] = (inv[i] * i) % MOD
        return fact, inv


if __name__ == "__main__":
    N, K = map(int, input().split())
    MOD = 10**9+7
    comb = Combination(2*10**5+5, MOD)

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

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