class Combination:
    def __init__(self, mod, max_num):
        self.mod = mod
        self.fac = [0] * max_num
        self.finv = [0] * max_num
        self.inv = [0] * max_num

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

        for i in range(2, max_num):
            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 calc(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return self.fac[n] * (
            self.finv[k] * self.finv[n - k] % self.mod) % self.mod


n, k = map(int, input().split())
com = Combination(1000000007, 500000)

ret = 1

min_val = min(n, k)

for i in range(1, min_val+1):
    if i != n:
        ret += com.calc(n, i) * com.calc(n-1, i)
        ret %= 10 ** 9 + 7
    else:
        ret += 0

print(ret) class Combination:
    def __init__(self, mod, max_num):
        self.mod = mod
        self.fac = [0] * max_num
        self.finv = [0] * max_num
        self.inv = [0] * max_num

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

        for i in range(2, max_num):
            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 calc(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return self.fac[n] * (
            self.finv[k] * self.finv[n - k] % self.mod) % self.mod Combination def __init__(self, mod, max_num):
        self.mod = mod
        self.fac = [0] * max_num
        self.finv = [0] * max_num
        self.inv = [0] * max_num

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

        for i in range(2, max_num):
            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__ self.mod = mod self.mod self mod mod self.fac = [0] * max_num self.fac self fac [0] * max_num [0] 0 max_num self.finv = [0] * max_num self.finv self finv [0] * max_num [0] 0 max_num self.inv = [0] * max_num self.inv self inv [0] * max_num [0] 0 max_num self.fac[0], self.fac[1] = 1, 1 self.fac[0] self.fac self fac 0 1 self.fac[1] self.fac self fac 1 1 self.finv[0], self.finv[1] = 1, 1 self.finv[0] self.finv self finv 0 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, max_num):
            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, max_num) range 2 max_num 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 mod mod max_num max_num def calc(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return self.fac[n] * (
            self.finv[k] * self.finv[n - k] % self.mod) % self.mod calc if n < k:
            return 0
         n < k n k return 0 0 if n < 0 or k < 0:
            return 0
         n < 0 or k < 0 n < 0 n 0 k < 0 k 0 return 0 0 return self.fac[n] * (
            self.finv[k] * self.finv[n - k] % self.mod) % self.mod self.fac[n] * (
            self.finv[k] * self.finv[n - k] % self.mod) % self.mod self.fac[n] * (
            self.finv[k] * self.finv[n - k] % self.mod) self.fac[n] self.fac self fac n self.finv[k] * self.finv[n - k] % self.mod self.finv[k] * self.finv[n - k] self.finv[k] self.finv self finv k self.finv[n - k] self.finv self finv n - k n k self.mod self mod self.mod self mod self self n n k k n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k com = Combination(1000000007, 500000) com Combination(1000000007, 500000) Combination 1000000007 500000 ret = 1 ret 1 min_val = min(n, k) min_val min(n, k) min n k for i in range(1, min_val+1):
    if i != n:
        ret += com.calc(n, i) * com.calc(n-1, i)
        ret %= 10 ** 9 + 7
    else:
        ret += 0 i range(1, min_val+1) range 1 min_val+1 min_val 1 if i != n:
        ret += com.calc(n, i) * com.calc(n-1, i)
        ret %= 10 ** 9 + 7
    else:
        ret += 0 i != n i n ret += com.calc(n, i) * com.calc(n-1, i) ret com.calc(n, i) * com.calc(n-1, i) com.calc(n, i) com.calc com calc n i com.calc(n-1, i) com.calc com calc n-1 n 1 i ret %= 10 ** 9 + 7 ret 10 ** 9 + 7 10 ** 9 10 9 7 ret += 0 ret 0 print(ret) print ret ret = 1 1 ret ret += com.calc(n, i) * com.calc(n-1, i) com.calc(n, i) * com.calc(n-1, i) ret ret += 0 0 ret n, k = map(int, input().split()) map(int, input().split()) n min_val = min(n, k) min(n, k) min_val k = map(int, input().split()) map(int, input().split()) k class Combination:
    def __init__(self, mod, max_num):
        self.mod = mod
        self.fac = [0] * max_num
        self.finv = [0] * max_num
        self.inv = [0] * max_num

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

        for i in range(2, max_num):
            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 calc(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return self.fac[n] * (
            self.finv[k] * self.finv[n - k] % self.mod) % self.mod class Combination:
    def __init__(self, mod, max_num):
        self.mod = mod
        self.fac = [0] * max_num
        self.finv = [0] * max_num
        self.inv = [0] * max_num

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

        for i in range(2, max_num):
            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 calc(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return self.fac[n] * (
            self.finv[k] * self.finv[n - k] % self.mod) % self.mod Combination com = Combination(1000000007, 500000) Combination(1000000007, 500000) com ret %= 10 ** 9 + 7 10 ** 9 + 7 ret
class Combination:
    def __init__(self, mod, max_num):
        self.mod = mod
        self.fac = [0] * max_num
        self.finv = [0] * max_num
        self.inv = [0] * max_num

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

        for i in range(2, max_num):
            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 calc(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return self.fac[n] * (
            self.finv[k] * self.finv[n - k] % self.mod) % self.mod


n, k = map(int, input().split())
com = Combination(1000000007, 500000)

ret = 1

min_val = min(n, k)

for i in range(1, min_val+1):
    if i != n:
        ret += com.calc(n, i) * com.calc(n-1, i)
        ret %= 10 ** 9 + 7
    else:
        ret += 0

print(ret)
