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


class ModInt:
    def __init__(self, num, mod):
        self.num = num
        self.mod = mod

    def __str__(self):
        return str(self.num)

    def __repr__(self):
        return "ModInt(num: {}, mod: {}".format(self.num, self.mod)

    def __add__(self, other):
        ret = self.num + other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def __sub__(self, other):
        ret = self.num - other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def __mul__(self, other):
        ret = self.num * other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def pow(self, times):
        pw = pow(self.num, times, self.mod)
        return ModInt(pw, self.mod)

    def inverse(self):
        return self.pow(self.mod - 2)

    def __truediv__(self, other):
        num = self * other.inverse()
        return ModInt(num, self.mod)


class Combination:
    def __init__(self, n, mod):
        self.mod = mod
        self.fact = [ModInt(1, mod)]
        self.inverse = [ModInt(1, mod)]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * ModInt(i, mod))
            self.inverse.append(self.inverse[-1] * ModInt(i, mod).inverse())

    def comb(self, n, k):
        if k < 0 or n < k:
            return ModInt(0, self.mod)

        return self.fact[n] * self.inverse[k] * self.inverse[n-k]


mx = min(k, n - 1)
comb = Combination(n, mod)
ans = ModInt(0, mod)

for i in range(mx + 1):
    ans += comb.comb(n, i) * comb.comb(n - 1, i)

print(ans) 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 class ModInt:
    def __init__(self, num, mod):
        self.num = num
        self.mod = mod

    def __str__(self):
        return str(self.num)

    def __repr__(self):
        return "ModInt(num: {}, mod: {}".format(self.num, self.mod)

    def __add__(self, other):
        ret = self.num + other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def __sub__(self, other):
        ret = self.num - other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def __mul__(self, other):
        ret = self.num * other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def pow(self, times):
        pw = pow(self.num, times, self.mod)
        return ModInt(pw, self.mod)

    def inverse(self):
        return self.pow(self.mod - 2)

    def __truediv__(self, other):
        num = self * other.inverse()
        return ModInt(num, self.mod) ModInt def __init__(self, num, mod):
        self.num = num
        self.mod = mod

     __init__ self.num = num self.num self num num self.mod = mod self.mod self mod mod self self num num mod mod def __str__(self):
        return str(self.num)

     __str__ return str(self.num) str(self.num) str self.num self num self self def __repr__(self):
        return "ModInt(num: {}, mod: {}".format(self.num, self.mod)

     __repr__ return "ModInt(num: {}, mod: {}".format(self.num, self.mod) "ModInt(num: {}, mod: {}".format(self.num, self.mod) "ModInt(num: {}, mod: {}".format "ModInt(num: {}, mod: {}" format self.num self num self.mod self mod self self def __add__(self, other):
        ret = self.num + other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

     __add__ ret = self.num + other.num ret self.num + other.num self.num self num other.num other num ret %= self.mod ret self.mod self mod return ModInt(ret, self.mod) ModInt(ret, self.mod) ModInt ret self.mod self mod self self other other def __sub__(self, other):
        ret = self.num - other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

     __sub__ ret = self.num - other.num ret self.num - other.num self.num self num other.num other num ret %= self.mod ret self.mod self mod return ModInt(ret, self.mod) ModInt(ret, self.mod) ModInt ret self.mod self mod self self other other def __mul__(self, other):
        ret = self.num * other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

     __mul__ ret = self.num * other.num ret self.num * other.num self.num self num other.num other num ret %= self.mod ret self.mod self mod return ModInt(ret, self.mod) ModInt(ret, self.mod) ModInt ret self.mod self mod self self other other def pow(self, times):
        pw = pow(self.num, times, self.mod)
        return ModInt(pw, self.mod)

     pow pw = pow(self.num, times, self.mod) pw pow(self.num, times, self.mod) pow self.num self num times self.mod self mod return ModInt(pw, self.mod) ModInt(pw, self.mod) ModInt pw self.mod self mod self self times times def inverse(self):
        return self.pow(self.mod - 2)

     inverse return self.pow(self.mod - 2) self.pow(self.mod - 2) self.pow self pow self.mod - 2 self.mod self mod 2 self self def __truediv__(self, other):
        num = self * other.inverse()
        return ModInt(num, self.mod) __truediv__ num = self * other.inverse() num self * other.inverse() self other.inverse() other.inverse other inverse return ModInt(num, self.mod) ModInt(num, self.mod) ModInt num self.mod self mod self self other other class Combination:
    def __init__(self, n, mod):
        self.mod = mod
        self.fact = [ModInt(1, mod)]
        self.inverse = [ModInt(1, mod)]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * ModInt(i, mod))
            self.inverse.append(self.inverse[-1] * ModInt(i, mod).inverse())

    def comb(self, n, k):
        if k < 0 or n < k:
            return ModInt(0, self.mod)

        return self.fact[n] * self.inverse[k] * self.inverse[n-k] Combination def __init__(self, n, mod):
        self.mod = mod
        self.fact = [ModInt(1, mod)]
        self.inverse = [ModInt(1, mod)]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * ModInt(i, mod))
            self.inverse.append(self.inverse[-1] * ModInt(i, mod).inverse())

     __init__ self.mod = mod self.mod self mod mod self.fact = [ModInt(1, mod)] self.fact self fact [ModInt(1, mod)] ModInt(1, mod) ModInt 1 mod self.inverse = [ModInt(1, mod)] self.inverse self inverse [ModInt(1, mod)] ModInt(1, mod) ModInt 1 mod for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * ModInt(i, mod))
            self.inverse.append(self.inverse[-1] * ModInt(i, mod).inverse())

     i range(1, n + 1) range 1 n + 1 n 1 self.fact.append(self.fact[-1] * ModInt(i, mod)) self.fact.append self.fact self fact append self.fact[-1] * ModInt(i, mod) self.fact[-1] self.fact self fact -1 ModInt(i, mod) ModInt i mod self.inverse.append(self.inverse[-1] * ModInt(i, mod).inverse()) self.inverse.append self.inverse self inverse append self.inverse[-1] * ModInt(i, mod).inverse() self.inverse[-1] self.inverse self inverse -1 ModInt(i, mod).inverse() (i, mod).inverse (i, mod) ModInt i mod inverse self self n n mod mod def comb(self, n, k):
        if k < 0 or n < k:
            return ModInt(0, self.mod)

        return self.fact[n] * self.inverse[k] * self.inverse[n-k] comb if k < 0 or n < k:
            return ModInt(0, self.mod)

         k < 0 or n < k k < 0 k 0 n < k n k return ModInt(0, self.mod) ModInt(0, self.mod) ModInt 0 self.mod self mod return self.fact[n] * self.inverse[k] * self.inverse[n-k] self.fact[n] * self.inverse[k] * self.inverse[n-k] self.fact[n] * self.inverse[k] self.fact[n] self.fact self fact n self.inverse[k] self.inverse self inverse k self.inverse[n-k] self.inverse self inverse n-k n k self self n n k k mx = min(k, n - 1) mx min(k, n - 1) min k n - 1 n 1 comb = Combination(n, mod) comb Combination(n, mod) Combination n mod ans = ModInt(0, mod) ans ModInt(0, mod) ModInt 0 mod for i in range(mx + 1):
    ans += comb.comb(n, i) * comb.comb(n - 1, i) i range(mx + 1) range mx + 1 mx 1 ans += comb.comb(n, i) * comb.comb(n - 1, i) ans comb.comb(n, i) * comb.comb(n - 1, i) comb.comb(n, i) comb.comb comb comb n i comb.comb(n - 1, i) comb.comb comb comb n - 1 n 1 i print(ans) print ans k = map(int, input().split()) map(int, input().split()) k mx = min(k, n - 1) min(k, n - 1) mx ans += comb.comb(n, i) * comb.comb(n - 1, i) comb.comb(n, i) * comb.comb(n - 1, i) ans mod = 10 ** 9 + 7 10 ** 9 + 7 mod comb = Combination(n, mod) Combination(n, mod) comb class ModInt:
    def __init__(self, num, mod):
        self.num = num
        self.mod = mod

    def __str__(self):
        return str(self.num)

    def __repr__(self):
        return "ModInt(num: {}, mod: {}".format(self.num, self.mod)

    def __add__(self, other):
        ret = self.num + other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def __sub__(self, other):
        ret = self.num - other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def __mul__(self, other):
        ret = self.num * other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def pow(self, times):
        pw = pow(self.num, times, self.mod)
        return ModInt(pw, self.mod)

    def inverse(self):
        return self.pow(self.mod - 2)

    def __truediv__(self, other):
        num = self * other.inverse()
        return ModInt(num, self.mod) class ModInt:
    def __init__(self, num, mod):
        self.num = num
        self.mod = mod

    def __str__(self):
        return str(self.num)

    def __repr__(self):
        return "ModInt(num: {}, mod: {}".format(self.num, self.mod)

    def __add__(self, other):
        ret = self.num + other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def __sub__(self, other):
        ret = self.num - other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def __mul__(self, other):
        ret = self.num * other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def pow(self, times):
        pw = pow(self.num, times, self.mod)
        return ModInt(pw, self.mod)

    def inverse(self):
        return self.pow(self.mod - 2)

    def __truediv__(self, other):
        num = self * other.inverse()
        return ModInt(num, self.mod) ModInt ans = ModInt(0, mod) ModInt(0, mod) ans class Combination:
    def __init__(self, n, mod):
        self.mod = mod
        self.fact = [ModInt(1, mod)]
        self.inverse = [ModInt(1, mod)]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * ModInt(i, mod))
            self.inverse.append(self.inverse[-1] * ModInt(i, mod).inverse())

    def comb(self, n, k):
        if k < 0 or n < k:
            return ModInt(0, self.mod)

        return self.fact[n] * self.inverse[k] * self.inverse[n-k] class Combination:
    def __init__(self, n, mod):
        self.mod = mod
        self.fact = [ModInt(1, mod)]
        self.inverse = [ModInt(1, mod)]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * ModInt(i, mod))
            self.inverse.append(self.inverse[-1] * ModInt(i, mod).inverse())

    def comb(self, n, k):
        if k < 0 or n < k:
            return ModInt(0, self.mod)

        return self.fact[n] * self.inverse[k] * self.inverse[n-k] Combination n, k = map(int, input().split()) map(int, input().split()) n
n, k = map(int, input().split())
mod = 10 ** 9 + 7


class ModInt:
    def __init__(self, num, mod):
        self.num = num
        self.mod = mod

    def __str__(self):
        return str(self.num)

    def __repr__(self):
        return "ModInt(num: {}, mod: {}".format(self.num, self.mod)

    def __add__(self, other):
        ret = self.num + other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def __sub__(self, other):
        ret = self.num - other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def __mul__(self, other):
        ret = self.num * other.num
        ret %= self.mod
        return ModInt(ret, self.mod)

    def pow(self, times):
        pw = pow(self.num, times, self.mod)
        return ModInt(pw, self.mod)

    def inverse(self):
        return self.pow(self.mod - 2)

    def __truediv__(self, other):
        num = self * other.inverse()
        return ModInt(num, self.mod)


class Combination:
    def __init__(self, n, mod):
        self.mod = mod
        self.fact = [ModInt(1, mod)]
        self.inverse = [ModInt(1, mod)]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * ModInt(i, mod))
            self.inverse.append(self.inverse[-1] * ModInt(i, mod).inverse())

    def comb(self, n, k):
        if k < 0 or n < k:
            return ModInt(0, self.mod)

        return self.fact[n] * self.inverse[k] * self.inverse[n-k]


mx = min(k, n - 1)
comb = Combination(n, mod)
ans = ModInt(0, mod)

for i in range(mx + 1):
    ans += comb.comb(n, i) * comb.comb(n - 1, i)

print(ans)
