class Combination:
    """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う"""
    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
        self.MOD = MOD

    def factorial(self, k):
        """k!を求める O(1)"""
        return self.fact[k]

    def inverse_factorial(self, k):
        """k!の逆元を求める O(1)"""
        return self.inv_fact[k]

    def permutation(self, k, r):
        """kPrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.MOD

    def combination(self, k, r):
        """kCrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD


n, k = map(int, input().split())
MOD = 10 ** 9 + 7

max_empty = min(n - 1, k)
comb = Combination(10 ** 6, MOD)
ans = 0
for i in range(0, max_empty + 1):
    box = n - i
    ball = n
    ans += comb.combination(ball - 1, box - 1) * comb.combination(n, box)
    ans %= MOD
print(ans) class Combination:
    """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う"""
    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
        self.MOD = MOD

    def factorial(self, k):
        """k!を求める O(1)"""
        return self.fact[k]

    def inverse_factorial(self, k):
        """k!の逆元を求める O(1)"""
        return self.inv_fact[k]

    def permutation(self, k, r):
        """kPrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.MOD

    def combination(self, k, r):
        """kCrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD Combination """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う""" def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
        self.MOD = MOD

     __init__ self.fact = [1] self.fact self fact [1] 1 for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
         i range(1, n + 1) range 1 n + 1 n 1 self.fact.append(self.fact[-1] * i % MOD) self.fact.append self.fact self fact append self.fact[-1] * i % MOD self.fact[-1] * i self.fact[-1] self.fact self fact -1 i MOD self.inv_fact = [0] * (n + 1) self.inv_fact self inv_fact [0] * (n + 1) [0] 0 n + 1 n 1 self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD) self.inv_fact[n] self.inv_fact self inv_fact n pow(self.fact[n], MOD - 2, MOD) pow self.fact[n] self.fact self fact n MOD - 2 MOD 2 MOD for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
         i reversed(range(n)) reversed range(n) range n self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD self.inv_fact[i] self.inv_fact self inv_fact i self.inv_fact[i + 1] * (i + 1) % MOD self.inv_fact[i + 1] * (i + 1) self.inv_fact[i + 1] self.inv_fact self inv_fact i + 1 i 1 i + 1 i 1 MOD self.MOD = MOD self.MOD self MOD MOD self self n n MOD MOD def factorial(self, k):
        """k!を求める O(1)"""
        return self.fact[k]

     factorial """k!を求める O(1)""" return self.fact[k] self.fact[k] self.fact self fact k self self k k def inverse_factorial(self, k):
        """k!の逆元を求める O(1)"""
        return self.inv_fact[k]

     inverse_factorial """k!の逆元を求める O(1)""" return self.inv_fact[k] self.inv_fact[k] self.inv_fact self inv_fact k self self k k def permutation(self, k, r):
        """kPrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.MOD

     permutation """kPrを求める O(1)""" if k < r:
            return 0
         k < r k r return 0 0 return (self.fact[k] * self.inv_fact[k - r]) % self.MOD (self.fact[k] * self.inv_fact[k - r]) % self.MOD self.fact[k] * self.inv_fact[k - r] self.fact[k] self.fact self fact k self.inv_fact[k - r] self.inv_fact self inv_fact k - r k r self.MOD self MOD self self k k r r def combination(self, k, r):
        """kCrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD combination """kCrを求める O(1)""" if k < r:
            return 0
         k < r k r return 0 0 return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r] self.fact[k] * self.inv_fact[k - r] self.fact[k] self.fact self fact k self.inv_fact[k - r] self.inv_fact self inv_fact k - r k r self.inv_fact[r] self.inv_fact self inv_fact r self.MOD self MOD self self k k r r 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 max_empty = min(n - 1, k) max_empty min(n - 1, k) min n - 1 n 1 k comb = Combination(10 ** 6, MOD) comb Combination(10 ** 6, MOD) Combination 10 ** 6 10 6 MOD ans = 0 ans 0 for i in range(0, max_empty + 1):
    box = n - i
    ball = n
    ans += comb.combination(ball - 1, box - 1) * comb.combination(n, box)
    ans %= MOD i range(0, max_empty + 1) range 0 max_empty + 1 max_empty 1 box = n - i box n - i n i ball = n ball n ans += comb.combination(ball - 1, box - 1) * comb.combination(n, box) ans comb.combination(ball - 1, box - 1) * comb.combination(n, box) comb.combination(ball - 1, box - 1) comb.combination comb combination ball - 1 ball 1 box - 1 box 1 comb.combination(n, box) comb.combination comb combination n box ans %= MOD ans MOD print(ans) print ans MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD ans %= MOD MOD ans box = n - i n - i box ans = 0 0 ans class Combination:
    """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う"""
    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
        self.MOD = MOD

    def factorial(self, k):
        """k!を求める O(1)"""
        return self.fact[k]

    def inverse_factorial(self, k):
        """k!の逆元を求める O(1)"""
        return self.inv_fact[k]

    def permutation(self, k, r):
        """kPrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.MOD

    def combination(self, k, r):
        """kCrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD class Combination:
    """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う"""
    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
        self.MOD = MOD

    def factorial(self, k):
        """k!を求める O(1)"""
        return self.fact[k]

    def inverse_factorial(self, k):
        """k!の逆元を求める O(1)"""
        return self.inv_fact[k]

    def permutation(self, k, r):
        """kPrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.MOD

    def combination(self, k, r):
        """kCrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD Combination max_empty = min(n - 1, k) min(n - 1, k) max_empty ans += comb.combination(ball - 1, box - 1) * comb.combination(n, box) comb.combination(ball - 1, box - 1) * comb.combination(n, box) ans ball = n n ball k = map(int, input().split()) map(int, input().split()) k comb = Combination(10 ** 6, MOD) Combination(10 ** 6, MOD) comb n, k = map(int, input().split()) map(int, input().split()) n
class Combination:
    """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う"""
    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
        self.MOD = MOD

    def factorial(self, k):
        """k!を求める O(1)"""
        return self.fact[k]

    def inverse_factorial(self, k):
        """k!の逆元を求める O(1)"""
        return self.inv_fact[k]

    def permutation(self, k, r):
        """kPrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.MOD

    def combination(self, k, r):
        """kCrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD


n, k = map(int, input().split())
MOD = 10 ** 9 + 7

max_empty = min(n - 1, k)
comb = Combination(10 ** 6, MOD)
ans = 0
for i in range(0, max_empty + 1):
    box = n - i
    ball = n
    ans += comb.combination(ball - 1, box - 1) * comb.combination(n, box)
    ans %= MOD
print(ans)