#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from functools import reduce
table_size = 510000
# table_size = 5100000
mod = 10**9+7


# Combination の計算を最適化する必要がある?
# def nCr(n, r):
#     numerator = reduce(lambda x, y: x * y % mod, range(n, n - r, -1), 1)
#     denominator = reduce(lambda x, y: x * y % mod, range(1, r + 1), 1)
#     return numerator * pow(denominator, mod-2, mod) % mod

class Combination:
    def __init__(self):
        self.fac = [None for _ in range(table_size)]
        self.finv = [None for _ in range(table_size)]
        self.inv = [None for _ in range(table_size)]

        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1

        for i in range(2, table_size):
            self.fac[i] = self.fac[i - 1] * i % mod
            self.inv[i] = mod - self.inv[mod % i] * (mod // i) % mod
            self.finv[i] = self.finv[i - 1] * self.inv[i] % mod

    def nCr(self, n, r):
        if n < r:
            return 0
        if n < 0 or r < 0:
            return 0

        return self.fac[n] * (self.finv[r] * self.finv[n - r] % mod) % mod


n, k = map(int, input().split())
# n, k = 3, 2  # Expected: 10
# n, k = 200000, 1000000000  # Expected: 607923868
# n, k = 15, 6  # Expected: 22583772

c = Combination()

# この分岐がよくわかっていない
if n < k:
    print(c.nCr(2 * n - 1, n))
else:
    total = 0
    for i in range(k + 1):
        total += c.nCr(n - 1, i) * c.nCr(n, i)
        total %= mod

    print(total) from functools import reduce table_size = 510000 table_size 510000 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 class Combination:
    def __init__(self):
        self.fac = [None for _ in range(table_size)]
        self.finv = [None for _ in range(table_size)]
        self.inv = [None for _ in range(table_size)]

        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1

        for i in range(2, table_size):
            self.fac[i] = self.fac[i - 1] * i % mod
            self.inv[i] = mod - self.inv[mod % i] * (mod // i) % mod
            self.finv[i] = self.finv[i - 1] * self.inv[i] % mod

    def nCr(self, n, r):
        if n < r:
            return 0
        if n < 0 or r < 0:
            return 0

        return self.fac[n] * (self.finv[r] * self.finv[n - r] % mod) % mod Combination def __init__(self):
        self.fac = [None for _ in range(table_size)]
        self.finv = [None for _ in range(table_size)]
        self.inv = [None for _ in range(table_size)]

        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1

        for i in range(2, table_size):
            self.fac[i] = self.fac[i - 1] * i % mod
            self.inv[i] = mod - self.inv[mod % i] * (mod // i) % mod
            self.finv[i] = self.finv[i - 1] * self.inv[i] % mod

     __init__ None for _ in range(table_size) for _ in range(table_size) _ range(table_size) range table_size for _ in range(table_size) None self.fac = [None for _ in range(table_size)] self.fac self fac [None for _ in range(table_size)] None for _ in range(table_size) for _ in range(table_size) _ range(table_size) range table_size for _ in range(table_size) None self.finv = [None for _ in range(table_size)] self.finv self finv [None for _ in range(table_size)] None for _ in range(table_size) for _ in range(table_size) _ range(table_size) range table_size for _ in range(table_size) None self.inv = [None for _ in range(table_size)] self.inv self inv [None for _ in range(table_size)] self.fac[0] = self.fac[1] = 1 self.fac[0] self.fac self fac 0 1 = self.fac[1] = 1 self.fac[1] self.fac self fac 1 1 self.finv[0] = self.finv[1] = 1 self.finv[0] self.finv self finv 0 1 = self.finv[1] = 1 self.finv[1] self.finv self finv 1 1 self.inv[1] = 1 self.inv[1] self.inv self inv 1 1 for i in range(2, table_size):
            self.fac[i] = self.fac[i - 1] * i % mod
            self.inv[i] = mod - self.inv[mod % i] * (mod // i) % mod
            self.finv[i] = self.finv[i - 1] * self.inv[i] % mod

     i range(2, table_size) range 2 table_size self.fac[i] = self.fac[i - 1] * i % mod self.fac[i] self.fac self fac i self.fac[i - 1] * i % mod self.fac[i - 1] * i self.fac[i - 1] self.fac self fac i - 1 i 1 i mod self.inv[i] = mod - self.inv[mod % i] * (mod // i) % mod self.inv[i] self.inv self inv i mod - self.inv[mod % i] * (mod // i) % mod mod self.inv[mod % i] * (mod // i) % mod self.inv[mod % i] * (mod // i) self.inv[mod % i] self.inv self inv mod % i mod i mod // i mod i mod self.finv[i] = self.finv[i - 1] * self.inv[i] % mod self.finv[i] self.finv self finv i self.finv[i - 1] * self.inv[i] % mod self.finv[i - 1] * self.inv[i] self.finv[i - 1] self.finv self finv i - 1 i 1 self.inv[i] self.inv self inv i mod self self def nCr(self, n, r):
        if n < r:
            return 0
        if n < 0 or r < 0:
            return 0

        return self.fac[n] * (self.finv[r] * self.finv[n - r] % mod) % mod nCr if n < r:
            return 0
         n < r n r return 0 0 if n < 0 or r < 0:
            return 0

         n < 0 or r < 0 n < 0 n 0 r < 0 r 0 return 0 0 return self.fac[n] * (self.finv[r] * self.finv[n - r] % mod) % mod self.fac[n] * (self.finv[r] * self.finv[n - r] % mod) % mod self.fac[n] * (self.finv[r] * self.finv[n - r] % mod) self.fac[n] self.fac self fac n self.finv[r] * self.finv[n - r] % mod self.finv[r] * self.finv[n - r] self.finv[r] self.finv self finv r self.finv[n - r] self.finv self finv n - r n r mod mod 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 c = Combination() c Combination() Combination if n < k:
    print(c.nCr(2 * n - 1, n))
else:
    total = 0
    for i in range(k + 1):
        total += c.nCr(n - 1, i) * c.nCr(n, i)
        total %= mod

    print(total) n < k n k print(c.nCr(2 * n - 1, n)) print c.nCr(2 * n - 1, n) c.nCr c nCr 2 * n - 1 2 * n 2 n 1 n total = 0 total 0 for i in range(k + 1):
        total += c.nCr(n - 1, i) * c.nCr(n, i)
        total %= mod

     i range(k + 1) range k + 1 k 1 total += c.nCr(n - 1, i) * c.nCr(n, i) total c.nCr(n - 1, i) * c.nCr(n, i) c.nCr(n - 1, i) c.nCr c nCr n - 1 n 1 i c.nCr(n, i) c.nCr c nCr n i total %= mod total mod print(total) print total table_size = 510000 510000 table_size mod = 10**9+7 10**9+7 mod n, k = map(int, input().split()) map(int, input().split()) n k = map(int, input().split()) map(int, input().split()) k c = Combination() Combination() c total = 0 0 total class Combination:
    def __init__(self):
        self.fac = [None for _ in range(table_size)]
        self.finv = [None for _ in range(table_size)]
        self.inv = [None for _ in range(table_size)]

        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1

        for i in range(2, table_size):
            self.fac[i] = self.fac[i - 1] * i % mod
            self.inv[i] = mod - self.inv[mod % i] * (mod // i) % mod
            self.finv[i] = self.finv[i - 1] * self.inv[i] % mod

    def nCr(self, n, r):
        if n < r:
            return 0
        if n < 0 or r < 0:
            return 0

        return self.fac[n] * (self.finv[r] * self.finv[n - r] % mod) % mod class Combination:
    def __init__(self):
        self.fac = [None for _ in range(table_size)]
        self.finv = [None for _ in range(table_size)]
        self.inv = [None for _ in range(table_size)]

        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1

        for i in range(2, table_size):
            self.fac[i] = self.fac[i - 1] * i % mod
            self.inv[i] = mod - self.inv[mod % i] * (mod // i) % mod
            self.finv[i] = self.finv[i - 1] * self.inv[i] % mod

    def nCr(self, n, r):
        if n < r:
            return 0
        if n < 0 or r < 0:
            return 0

        return self.fac[n] * (self.finv[r] * self.finv[n - r] % mod) % mod Combination total += c.nCr(n - 1, i) * c.nCr(n, i) c.nCr(n - 1, i) * c.nCr(n, i) total total %= mod mod total
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from functools import reduce
table_size = 510000
# table_size = 5100000
mod = 10**9+7


# Combination の計算を最適化する必要がある?
# def nCr(n, r):
#     numerator = reduce(lambda x, y: x * y % mod, range(n, n - r, -1), 1)
#     denominator = reduce(lambda x, y: x * y % mod, range(1, r + 1), 1)
#     return numerator * pow(denominator, mod-2, mod) % mod

class Combination:
    def __init__(self):
        self.fac = [None for _ in range(table_size)]
        self.finv = [None for _ in range(table_size)]
        self.inv = [None for _ in range(table_size)]

        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1

        for i in range(2, table_size):
            self.fac[i] = self.fac[i - 1] * i % mod
            self.inv[i] = mod - self.inv[mod % i] * (mod // i) % mod
            self.finv[i] = self.finv[i - 1] * self.inv[i] % mod

    def nCr(self, n, r):
        if n < r:
            return 0
        if n < 0 or r < 0:
            return 0

        return self.fac[n] * (self.finv[r] * self.finv[n - r] % mod) % mod


n, k = map(int, input().split())
# n, k = 3, 2  # Expected: 10
# n, k = 200000, 1000000000  # Expected: 607923868
# n, k = 15, 6  # Expected: 22583772

c = Combination()

# この分岐がよくわかっていない
if n < k:
    print(c.nCr(2 * n - 1, n))
else:
    total = 0
    for i in range(k + 1):
        total += c.nCr(n - 1, i) * c.nCr(n, i)
        total %= mod

    print(total)
