import sys


def input():
    return sys.stdin.readline().strip()


MOD = 10 ** 9 + 7
sys.setrecursionlimit(20000000)


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
        return modinv


def main():
    N, K = map(int, input().split())
    answer = 0
    if K >= N - 1:
        cmb = Combination(2 * N + 1)
        answer = cmb(N * 2 - 1, N - 1)

    else:
        cmb = Combination(N)
        for i in range(K + 1):
            answer += cmb(N, i) * cmb(N - 1, N - 1 - i)
    print(answer % MOD)


if __name__ == "__main__":
    main() import sys sys def input():
    return sys.stdin.readline().strip() input return sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 sys.setrecursionlimit(20000000) sys.setrecursionlimit sys setrecursionlimit 20000000 class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
        return modinv Combination """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """ def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

     __init__ self.mod = mod self.mod self mod mod self.modinv = self.make_modinv_list(n_max) self.modinv self modinv self.make_modinv_list(n_max) self.make_modinv_list self make_modinv_list n_max self.fac, self.facinv = self.make_factorial_list(n_max) self.fac self fac self.make_factorial_list(n_max) self.make_factorial_list self make_factorial_list n_max self.facinv self facinv self self n_max n_max mod=10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 def __call__(self, n, r):
        if n < r:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

     __call__ if n < r:
            return 0
         n < r n r return 0 0 return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] self.fac[n] * self.facinv[r] % self.mod self.fac[n] * self.facinv[r] self.fac[n] self.fac self fac n self.facinv[r] self.facinv self facinv r self.mod self mod self.facinv[n - r] self.facinv self facinv n - r n r self.mod self mod self self n n r r def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

     make_factorial_list fac = [1] fac [1] 1 facinv = [1] facinv [1] 1 for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
         i range(1, n + 1) range 1 n + 1 n 1 fac.append(fac[i - 1] * i % self.mod) fac.append fac append fac[i - 1] * i % self.mod fac[i - 1] * i fac[i - 1] fac i - 1 i 1 i self.mod self mod facinv.append(facinv[i - 1] * self.modinv[i] % self.mod) facinv.append facinv append facinv[i - 1] * self.modinv[i] % self.mod facinv[i - 1] * self.modinv[i] facinv[i - 1] facinv i - 1 i 1 self.modinv[i] self.modinv self modinv i self.mod self mod return fac, facinv return fac, facinv fac facinv self self n n def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
        return modinv make_modinv_list modinv = [0] * (n + 1) modinv [0] * (n + 1) [0] 0 n + 1 n 1 modinv[1] = 1 modinv[1] modinv 1 1 for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
         i range(2, n + 1) range 2 n + 1 n 1 modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod modinv[i] modinv i self.mod - self.mod // i * modinv[self.mod % i] % self.mod self.mod self mod self.mod // i * modinv[self.mod % i] % self.mod self.mod // i * modinv[self.mod % i] self.mod // i self.mod self mod i modinv[self.mod % i] modinv self.mod % i self.mod self mod i self.mod self mod return modinv modinv self self n n def main():
    N, K = map(int, input().split())
    answer = 0
    if K >= N - 1:
        cmb = Combination(2 * N + 1)
        answer = cmb(N * 2 - 1, N - 1)

    else:
        cmb = Combination(N)
        for i in range(K + 1):
            answer += cmb(N, i) * cmb(N - 1, N - 1 - i)
    print(answer % MOD) main N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K answer = 0 answer 0 if K >= N - 1:
        cmb = Combination(2 * N + 1)
        answer = cmb(N * 2 - 1, N - 1)

    else:
        cmb = Combination(N)
        for i in range(K + 1):
            answer += cmb(N, i) * cmb(N - 1, N - 1 - i)
     K >= N - 1 K N - 1 N 1 cmb = Combination(2 * N + 1) cmb Combination(2 * N + 1) Combination 2 * N + 1 2 * N 2 N 1 answer = cmb(N * 2 - 1, N - 1) answer cmb(N * 2 - 1, N - 1) cmb N * 2 - 1 N * 2 N 2 1 N - 1 N 1 cmb = Combination(N) cmb Combination(N) Combination N for i in range(K + 1):
            answer += cmb(N, i) * cmb(N - 1, N - 1 - i)
     i range(K + 1) range K + 1 K 1 answer += cmb(N, i) * cmb(N - 1, N - 1 - i) answer cmb(N, i) * cmb(N - 1, N - 1 - i) cmb(N, i) cmb N i cmb(N - 1, N - 1 - i) cmb N - 1 N 1 N - 1 - i N - 1 N 1 i print(answer % MOD) print answer % MOD answer MOD if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def input():
    return sys.stdin.readline().strip() def input():
    return sys.stdin.readline().strip() input class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
        return modinv class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
        return modinv Combination def main():
    N, K = map(int, input().split())
    answer = 0
    if K >= N - 1:
        cmb = Combination(2 * N + 1)
        answer = cmb(N * 2 - 1, N - 1)

    else:
        cmb = Combination(N)
        for i in range(K + 1):
            answer += cmb(N, i) * cmb(N - 1, N - 1 - i)
    print(answer % MOD) def main():
    N, K = map(int, input().split())
    answer = 0
    if K >= N - 1:
        cmb = Combination(2 * N + 1)
        answer = cmb(N * 2 - 1, N - 1)

    else:
        cmb = Combination(N)
        for i in range(K + 1):
            answer += cmb(N, i) * cmb(N - 1, N - 1 - i)
    print(answer % MOD) main MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD
import sys


def input():
    return sys.stdin.readline().strip()


MOD = 10 ** 9 + 7
sys.setrecursionlimit(20000000)


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
        return modinv


def main():
    N, K = map(int, input().split())
    answer = 0
    if K >= N - 1:
        cmb = Combination(2 * N + 1)
        answer = cmb(N * 2 - 1, N - 1)

    else:
        cmb = Combination(N)
        for i in range(K + 1):
            answer += cmb(N, i) * cmb(N - 1, N - 1 - i)
    print(answer % MOD)


if __name__ == "__main__":
    main()
