MOD = 10**9 + 7

class Combination:
    def __init__(self, size):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % MOD
            self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % MOD

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1)

N, K = map(int, input().split())
K = min(K, N)
MOD = 10**9 + 7
comb = Combination(N + 100)

ans = 0
for k in range(K + 1):
    ans += comb.ncr(N, k) * comb.nhr(N - k, k)
    ans %= MOD

print(ans) MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 class Combination:
    def __init__(self, size):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % MOD
            self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % MOD

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1) Combination def __init__(self, size):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % MOD
            self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD

     __init__ self.size = size + 2 self.size self size size + 2 size 2 self.fact = [1, 1] + [0] * size self.fact self fact [1, 1] + [0] * size [1, 1] 1 1 [0] * size [0] 0 size self.factInv = [1, 1] + [0] * size self.factInv self factInv [1, 1] + [0] * size [1, 1] 1 1 [0] * size [0] 0 size self.inv = [0, 1] + [0] * size self.inv self inv [0, 1] + [0] * size [0, 1] 0 1 [0] * size [0] 0 size for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % MOD
            self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD

     i range(2, self.size) range 2 self.size self size self.fact[i] = self.fact[i - 1] * i % MOD self.fact[i] self.fact self fact i self.fact[i - 1] * i % MOD self.fact[i - 1] * i self.fact[i - 1] self.fact self fact i - 1 i 1 i MOD self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD self.inv[i] self.inv self inv i -self.inv[MOD % i] * (MOD // i) % MOD -self.inv[MOD % i] * (MOD // i) -self.inv[MOD % i] self.inv[MOD % i] self.inv self inv MOD % i MOD i MOD // i MOD i MOD self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD self.factInv[i] self.factInv self factInv i self.factInv[i - 1] * self.inv[i] % MOD self.factInv[i - 1] * self.inv[i] self.factInv[i - 1] self.factInv self factInv i - 1 i 1 self.inv[i] self.inv self inv i MOD self self size size def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % MOD

     npr if n < r or n < 0 or r < 0:
            return 0
         n < r or n < 0 or r < 0 n < r or n < 0 n < r n r n < 0 n 0 r < 0 r 0 return 0 0 return self.fact[n] * self.factInv[n - r] % MOD self.fact[n] * self.factInv[n - r] % MOD self.fact[n] * self.factInv[n - r] self.fact[n] self.fact self fact n self.factInv[n - r] self.factInv self factInv n - r n r MOD self self n n r r def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD

     ncr if n < r or n < 0 or r < 0:
            return 0
         n < r or n < 0 or r < 0 n < r or n < 0 n < r n r n < 0 n 0 r < 0 r 0 return 0 0 return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) self.fact[n] self.fact self fact n self.factInv[r] * self.factInv[n - r] % MOD self.factInv[r] * self.factInv[n - r] self.factInv[r] self.factInv self factInv r self.factInv[n - r] self.factInv self factInv n - r n r MOD MOD self self n n r r def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1) nhr return self.ncr(n + r - 1, n - 1) self.ncr(n + r - 1, n - 1) self.ncr self ncr n + r - 1 n + r n r 1 n - 1 n 1 self self n n r r N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K K = min(K, N) K min(K, N) min K N MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 comb = Combination(N + 100) comb Combination(N + 100) Combination N + 100 N 100 ans = 0 ans 0 for k in range(K + 1):
    ans += comb.ncr(N, k) * comb.nhr(N - k, k)
    ans %= MOD k range(K + 1) range K + 1 K 1 ans += comb.ncr(N, k) * comb.nhr(N - k, k) ans comb.ncr(N, k) * comb.nhr(N - k, k) comb.ncr(N, k) comb.ncr comb ncr N k comb.nhr(N - k, k) comb.nhr comb nhr N - k N k k ans %= MOD ans MOD print(ans) print ans ans += comb.ncr(N, k) * comb.nhr(N - k, k) comb.ncr(N, k) * comb.nhr(N - k, k) ans ans = 0 0 ans K = map(int, input().split()) map(int, input().split()) K class Combination:
    def __init__(self, size):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % MOD
            self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % MOD

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1) class Combination:
    def __init__(self, size):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % MOD
            self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % MOD

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1) Combination K = min(K, N) min(K, N) K comb = Combination(N + 100) Combination(N + 100) comb ans %= MOD MOD ans MOD = 10**9 + 7 10**9 + 7 MOD N, K = map(int, input().split()) map(int, input().split()) N MOD = 10**9 + 7 10**9 + 7 MOD
MOD = 10**9 + 7

class Combination:
    def __init__(self, size):
        self.size = size + 2
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % MOD
            self.inv[i] = -self.inv[MOD % i] * (MOD // i) % MOD
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % MOD

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % MOD

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % MOD) % MOD

    def nhr(self, n, r):  # 重複組合せ: x_1 + ... + x_n = r
        return self.ncr(n + r - 1, n - 1)

N, K = map(int, input().split())
K = min(K, N)
MOD = 10**9 + 7
comb = Combination(N + 100)

ans = 0
for k in range(K + 1):
    ans += comb.ncr(N, k) * comb.nhr(N - k, k)
    ans %= MOD

print(ans)
