U = 2 * 10 ** 5
mod = 10 ** 9 + 7


class Combination:
    """
    SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う
    使い方:
    comb = Combination(SIZE, MOD)
    comb(10, 3) => 120
    """

    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())
    comb = Combination(U + 5, mod)

    ans = 1
    for i in range(1, min(K + 1, N)):
        vacant = comb(N, i)
        person = comb(N - 1, i)
        ans = (ans + vacant * person % mod) % mod
    print(ans) U = 2 * 10 ** 5 U 2 * 10 ** 5 2 10 ** 5 10 5 mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 class Combination:
    """
    SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う
    使い方:
    comb = Combination(SIZE, MOD)
    comb(10, 3) => 120
    """

    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 """
    SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う
    使い方:
    comb = Combination(SIZE, MOD)
    comb(10, 3) => 120
    """ 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())
    comb = Combination(U + 5, mod)

    ans = 1
    for i in range(1, min(K + 1, N)):
        vacant = comb(N, i)
        person = comb(N - 1, i)
        ans = (ans + vacant * person % mod) % mod
    print(ans) __name__ == "__main__" __name__ "__main__" N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K comb = Combination(U + 5, mod) comb Combination(U + 5, mod) Combination U + 5 U 5 mod ans = 1 ans 1 for i in range(1, min(K + 1, N)):
        vacant = comb(N, i)
        person = comb(N - 1, i)
        ans = (ans + vacant * person % mod) % mod
     i range(1, min(K + 1, N)) range 1 min(K + 1, N) min K + 1 K 1 N vacant = comb(N, i) vacant comb(N, i) comb N i person = comb(N - 1, i) person comb(N - 1, i) comb N - 1 N 1 i ans = (ans + vacant * person % mod) % mod ans (ans + vacant * person % mod) % mod ans + vacant * person % mod ans vacant * person % mod vacant * person vacant person mod mod print(ans) print ans K = map(int, input().split()) map(int, input().split()) K ans = (ans + vacant * person % mod) % mod (ans + vacant * person % mod) % mod ans vacant = comb(N, i) comb(N, i) vacant person = comb(N - 1, i) comb(N - 1, i) person comb = Combination(U + 5, mod) Combination(U + 5, mod) comb class Combination:
    """
    SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う
    使い方:
    comb = Combination(SIZE, MOD)
    comb(10, 3) => 120
    """

    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:
    """
    SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う
    使い方:
    comb = Combination(SIZE, MOD)
    comb(10, 3) => 120
    """

    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 U = 2 * 10 ** 5 2 * 10 ** 5 U mod = 10 ** 9 + 7 10 ** 9 + 7 mod N, K = map(int, input().split()) map(int, input().split()) N ans = 1 1 ans
U = 2 * 10 ** 5
mod = 10 ** 9 + 7


class Combination:
    """
    SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う
    使い方:
    comb = Combination(SIZE, MOD)
    comb(10, 3) => 120
    """

    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())
    comb = Combination(U + 5, mod)

    ans = 1
    for i in range(1, min(K + 1, N)):
        vacant = comb(N, i)
        person = comb(N - 1, i)
        ans = (ans + vacant * person % mod) % mod
    print(ans)