class FastModComb:

    def __init__(self, n, mod=10 ** 9 + 7):
        f, self.mod = [1], mod
        for i in range(1, n + 1):
            f.append(f[-1] * i % mod)
        rf = [self.modpow(f[-1], mod - 2)]
        for i in range(1, n + 1):
            rf.append(rf[-1] * (n - i + 1) % mod)
        self.f, self.rf = f, list(reversed(rf))

    def modpow(self, a, b):
        ret = 1
        while b > 0:
            if b % 2 == 1:
                ret = ret * a % self.mod
            a = a * a % self.mod
            b //= 2
        return ret

    def modcomb(self, n, c):
        return self.f[n] * self.rf[c] * self.rf[n - c] % self.mod


n, k = map(int, input().split())
mod, mc = 10 ** 9 + 7, FastModComb(n)
print(sum([mc.modcomb(n, m) * mc.modcomb(n - 1, n - m - 1) % mod
           for m in range(min(n - 1, k) + 1)]) % mod) class FastModComb:

    def __init__(self, n, mod=10 ** 9 + 7):
        f, self.mod = [1], mod
        for i in range(1, n + 1):
            f.append(f[-1] * i % mod)
        rf = [self.modpow(f[-1], mod - 2)]
        for i in range(1, n + 1):
            rf.append(rf[-1] * (n - i + 1) % mod)
        self.f, self.rf = f, list(reversed(rf))

    def modpow(self, a, b):
        ret = 1
        while b > 0:
            if b % 2 == 1:
                ret = ret * a % self.mod
            a = a * a % self.mod
            b //= 2
        return ret

    def modcomb(self, n, c):
        return self.f[n] * self.rf[c] * self.rf[n - c] % self.mod FastModComb def __init__(self, n, mod=10 ** 9 + 7):
        f, self.mod = [1], mod
        for i in range(1, n + 1):
            f.append(f[-1] * i % mod)
        rf = [self.modpow(f[-1], mod - 2)]
        for i in range(1, n + 1):
            rf.append(rf[-1] * (n - i + 1) % mod)
        self.f, self.rf = f, list(reversed(rf))

     __init__ f, self.mod = [1], mod f [1] 1 self.mod self mod mod for i in range(1, n + 1):
            f.append(f[-1] * i % mod)
         i range(1, n + 1) range 1 n + 1 n 1 f.append(f[-1] * i % mod) f.append f append f[-1] * i % mod f[-1] * i f[-1] f -1 i mod rf = [self.modpow(f[-1], mod - 2)] rf [self.modpow(f[-1], mod - 2)] self.modpow(f[-1], mod - 2) self.modpow self modpow f[-1] f -1 mod - 2 mod 2 for i in range(1, n + 1):
            rf.append(rf[-1] * (n - i + 1) % mod)
         i range(1, n + 1) range 1 n + 1 n 1 rf.append(rf[-1] * (n - i + 1) % mod) rf.append rf append rf[-1] * (n - i + 1) % mod rf[-1] * (n - i + 1) rf[-1] rf -1 n - i + 1 n - i n i 1 mod self.f, self.rf = f, list(reversed(rf)) self.f self f f self.rf self rf list(reversed(rf)) list reversed(rf) reversed rf self self n n mod=10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 def modpow(self, a, b):
        ret = 1
        while b > 0:
            if b % 2 == 1:
                ret = ret * a % self.mod
            a = a * a % self.mod
            b //= 2
        return ret

     modpow ret = 1 ret 1 while b > 0:
            if b % 2 == 1:
                ret = ret * a % self.mod
            a = a * a % self.mod
            b //= 2
         b > 0 b 0 if b % 2 == 1:
                ret = ret * a % self.mod
             b % 2 == 1 b % 2 b 2 1 ret = ret * a % self.mod ret ret * a % self.mod ret * a ret a self.mod self mod a = a * a % self.mod a a * a % self.mod a * a a a self.mod self mod b //= 2 b 2 return ret ret self self a a b b def modcomb(self, n, c):
        return self.f[n] * self.rf[c] * self.rf[n - c] % self.mod modcomb return self.f[n] * self.rf[c] * self.rf[n - c] % self.mod self.f[n] * self.rf[c] * self.rf[n - c] % self.mod self.f[n] * self.rf[c] * self.rf[n - c] self.f[n] * self.rf[c] self.f[n] self.f self f n self.rf[c] self.rf self rf c self.rf[n - c] self.rf self rf n - c n c self.mod self mod self self n n c c n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k mod, mc = 10 ** 9 + 7, FastModComb(n) mod 10 ** 9 + 7 10 ** 9 10 9 7 mc FastModComb(n) FastModComb n mc.modcomb(n, m) * mc.modcomb(n - 1, n - m - 1) % mod
           for m in range(min(n - 1, k) + 1) for m in range(min(n - 1, k) + 1) m range(min(n - 1, k) + 1) range min(n - 1, k) + 1 min(n - 1, k) min n - 1 n 1 k 1 for m in range(min(n - 1, k) + 1) mc.modcomb(n, m) * mc.modcomb(n - 1, n - m - 1) % mod mc.modcomb(n, m) * mc.modcomb(n - 1, n - m - 1) mc.modcomb(n, m) mc.modcomb mc modcomb n m mc.modcomb(n - 1, n - m - 1) mc.modcomb mc modcomb n - 1 n 1 n - m - 1 n - m n m 1 mod print(sum([mc.modcomb(n, m) * mc.modcomb(n - 1, n - m - 1) % mod
           for m in range(min(n - 1, k) + 1)]) % mod) print sum([mc.modcomb(n, m) * mc.modcomb(n - 1, n - m - 1) % mod
           for m in range(min(n - 1, k) + 1)]) % mod sum([mc.modcomb(n, m) * mc.modcomb(n - 1, n - m - 1) % mod
           for m in range(min(n - 1, k) + 1)]) sum [mc.modcomb(n, m) * mc.modcomb(n - 1, n - m - 1) % mod
           for m in range(min(n - 1, k) + 1)] mod class FastModComb:

    def __init__(self, n, mod=10 ** 9 + 7):
        f, self.mod = [1], mod
        for i in range(1, n + 1):
            f.append(f[-1] * i % mod)
        rf = [self.modpow(f[-1], mod - 2)]
        for i in range(1, n + 1):
            rf.append(rf[-1] * (n - i + 1) % mod)
        self.f, self.rf = f, list(reversed(rf))

    def modpow(self, a, b):
        ret = 1
        while b > 0:
            if b % 2 == 1:
                ret = ret * a % self.mod
            a = a * a % self.mod
            b //= 2
        return ret

    def modcomb(self, n, c):
        return self.f[n] * self.rf[c] * self.rf[n - c] % self.mod class FastModComb:

    def __init__(self, n, mod=10 ** 9 + 7):
        f, self.mod = [1], mod
        for i in range(1, n + 1):
            f.append(f[-1] * i % mod)
        rf = [self.modpow(f[-1], mod - 2)]
        for i in range(1, n + 1):
            rf.append(rf[-1] * (n - i + 1) % mod)
        self.f, self.rf = f, list(reversed(rf))

    def modpow(self, a, b):
        ret = 1
        while b > 0:
            if b % 2 == 1:
                ret = ret * a % self.mod
            a = a * a % self.mod
            b //= 2
        return ret

    def modcomb(self, n, c):
        return self.f[n] * self.rf[c] * self.rf[n - c] % self.mod FastModComb mc = 10 ** 9 + 7, FastModComb(n) FastModComb(n) mc k = map(int, input().split()) map(int, input().split()) k mod, mc = 10 ** 9 + 7, FastModComb(n) 10 ** 9 + 7 mod n, k = map(int, input().split()) map(int, input().split()) n
class FastModComb:

    def __init__(self, n, mod=10 ** 9 + 7):
        f, self.mod = [1], mod
        for i in range(1, n + 1):
            f.append(f[-1] * i % mod)
        rf = [self.modpow(f[-1], mod - 2)]
        for i in range(1, n + 1):
            rf.append(rf[-1] * (n - i + 1) % mod)
        self.f, self.rf = f, list(reversed(rf))

    def modpow(self, a, b):
        ret = 1
        while b > 0:
            if b % 2 == 1:
                ret = ret * a % self.mod
            a = a * a % self.mod
            b //= 2
        return ret

    def modcomb(self, n, c):
        return self.f[n] * self.rf[c] * self.rf[n - c] % self.mod


n, k = map(int, input().split())
mod, mc = 10 ** 9 + 7, FastModComb(n)
print(sum([mc.modcomb(n, m) * mc.modcomb(n - 1, n - m - 1) % mod
           for m in range(min(n - 1, k) + 1)]) % mod)
