class Combination:
    def __init__(self, size, mod=10**9 + 7):
        self.size = size + 2
        self.mod = mod
        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 % self.mod
            self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % self.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] % self.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] % self.mod) % self.mod

    def nhr(self, n, r):
        return self.ncr(n + r - 1, n - 1)

    def factN(self, n):
        if n < 0:
            return 0
        return self.fact[n]

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

L = max(1, N - K)

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

print(ans) class Combination:
    def __init__(self, size, mod=10**9 + 7):
        self.size = size + 2
        self.mod = mod
        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 % self.mod
            self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % self.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] % self.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] % self.mod) % self.mod

    def nhr(self, n, r):
        return self.ncr(n + r - 1, n - 1)

    def factN(self, n):
        if n < 0:
            return 0
        return self.fact[n] Combination def __init__(self, size, mod=10**9 + 7):
        self.size = size + 2
        self.mod = mod
        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 % self.mod
            self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % self.mod

     __init__ self.size = size + 2 self.size self size size + 2 size 2 self.mod = mod self.mod self mod mod 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 % self.mod
            self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % self.mod

     i range(2, self.size) range 2 self.size self size self.fact[i] = self.fact[i - 1] * i % self.mod self.fact[i] self.fact self fact i self.fact[i - 1] * i % self.mod self.fact[i - 1] * i self.fact[i - 1] self.fact self fact i - 1 i 1 i self.mod self mod self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod self.inv[i] self.inv self inv i -self.inv[self.mod % i] * (self.mod // i) % self.mod -self.inv[self.mod % i] * (self.mod // i) -self.inv[self.mod % i] self.inv[self.mod % i] self.inv self inv self.mod % i self.mod self mod i self.mod // i self.mod self mod i self.mod self mod self.factInv[i] = self.factInv[i - 1] * self.inv[i] % self.mod self.factInv[i] self.factInv self factInv i self.factInv[i - 1] * self.inv[i] % self.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 self.mod self mod self self size size mod=10**9 + 7 mod 10**9 + 7 10**9 10 9 7 def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % self.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] % self.mod self.fact[n] * self.factInv[n - r] % self.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 self.mod self 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] % self.mod) % self.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] % self.mod) % self.mod self.fact[n] * (self.factInv[r] * self.factInv[n - r] % self.mod) % self.mod self.fact[n] * (self.factInv[r] * self.factInv[n - r] % self.mod) self.fact[n] self.fact self fact n self.factInv[r] * self.factInv[n - r] % self.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 self.mod self mod self.mod self mod self self n n r r def nhr(self, 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 def factN(self, n):
        if n < 0:
            return 0
        return self.fact[n] factN if n < 0:
            return 0
         n < 0 n 0 return 0 0 return self.fact[n] self.fact[n] self.fact self fact n self self n n 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 comb = Combination(N * 2) comb Combination(N * 2) Combination N * 2 N 2 L = max(1, N - K) L max(1, N - K) max 1 N - K N K ans = 0 ans 0 for l in range(L, N + 1):
    zero = N - l
    ans += comb.ncr(N, zero) * comb.nhr(N - zero, zero)
    ans %= MOD l range(L, N + 1) range L N + 1 N 1 zero = N - l zero N - l N l ans += comb.ncr(N, zero) * comb.nhr(N - zero, zero) ans comb.ncr(N, zero) * comb.nhr(N - zero, zero) comb.ncr(N, zero) comb.ncr comb ncr N zero comb.nhr(N - zero, zero) comb.nhr comb nhr N - zero N zero zero ans %= MOD ans MOD print(ans) print ans ans %= MOD MOD ans N, K = map(int, input().split()) map(int, input().split()) N comb = Combination(N * 2) Combination(N * 2) comb K = map(int, input().split()) map(int, input().split()) K MOD = 10**9 + 7 10**9 + 7 MOD L = max(1, N - K) max(1, N - K) L zero = N - l N - l zero ans = 0 0 ans ans += comb.ncr(N, zero) * comb.nhr(N - zero, zero) comb.ncr(N, zero) * comb.nhr(N - zero, zero) ans class Combination:
    def __init__(self, size, mod=10**9 + 7):
        self.size = size + 2
        self.mod = mod
        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 % self.mod
            self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % self.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] % self.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] % self.mod) % self.mod

    def nhr(self, n, r):
        return self.ncr(n + r - 1, n - 1)

    def factN(self, n):
        if n < 0:
            return 0
        return self.fact[n] class Combination:
    def __init__(self, size, mod=10**9 + 7):
        self.size = size + 2
        self.mod = mod
        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 % self.mod
            self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % self.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] % self.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] % self.mod) % self.mod

    def nhr(self, n, r):
        return self.ncr(n + r - 1, n - 1)

    def factN(self, n):
        if n < 0:
            return 0
        return self.fact[n] Combination
class Combination:
    def __init__(self, size, mod=10**9 + 7):
        self.size = size + 2
        self.mod = mod
        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 % self.mod
            self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % self.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] % self.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] % self.mod) % self.mod

    def nhr(self, n, r):
        return self.ncr(n + r - 1, n - 1)

    def factN(self, n):
        if n < 0:
            return 0
        return self.fact[n]

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

L = max(1, N - K)

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

print(ans)