MOD = 10 ** 9 + 7

class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0


N, K = map(int, input().split())

K = min(K, N - 1)

F = Factorial(N + 1, MOD)

ans = 0
for k in range(K + 1):
    tmp = F.comb(N, k) * F.factorial(N - 1) * F.ifactorial(N - 1 - k) * F.ifactorial(k)
    ans += (tmp % MOD)
    ans %= MOD

print (ans) MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0 Factorial def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
     __init__ self.f = [1] self.f self f [1] 1 self.mod = mod self.mod self mod mod for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
         j range(1, n + 1) range 1 n + 1 n 1 self.f.append(self.f[-1] * j % mod) self.f.append self.f self f append self.f[-1] * j % mod self.f[-1] * j self.f[-1] self.f self f -1 j mod self.i = [pow(self.f[-1], mod - 2, mod)] self.i self i [pow(self.f[-1], mod - 2, mod)] pow(self.f[-1], mod - 2, mod) pow self.f[-1] self.f self f -1 mod - 2 mod 2 mod for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
         j range(n, 0, -1) range n 0 -1 self.i.append(self.i[-1] * j % mod) self.i.append self.i self i append self.i[-1] * j % mod self.i[-1] * j self.i[-1] self.i self i -1 j mod self.i.reverse() self.i.reverse self.i self i reverse self self n n mod mod def factorial(self, j):
        return self.f[j]
     factorial return self.f[j] self.f[j] self.f self f j self self j j def ifactorial(self, j):
        return self.i[j]
     ifactorial return self.i[j] self.i[j] self.i self i j self self j j def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0 comb return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0 self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0 n >= k n k self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod self.f[n] * self.i[n - k] % self.mod * self.i[k] self.f[n] * self.i[n - k] % self.mod self.f[n] * self.i[n - k] self.f[n] self.f self f n self.i[n - k] self.i self i n - k n k self.mod self mod self.i[k] self.i self i k self.mod self mod 0 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 K = min(K, N - 1) K min(K, N - 1) min K N - 1 N 1 F = Factorial(N + 1, MOD) F Factorial(N + 1, MOD) Factorial N + 1 N 1 MOD ans = 0 ans 0 for k in range(K + 1):
    tmp = F.comb(N, k) * F.factorial(N - 1) * F.ifactorial(N - 1 - k) * F.ifactorial(k)
    ans += (tmp % MOD)
    ans %= MOD k range(K + 1) range K + 1 K 1 tmp = F.comb(N, k) * F.factorial(N - 1) * F.ifactorial(N - 1 - k) * F.ifactorial(k) tmp F.comb(N, k) * F.factorial(N - 1) * F.ifactorial(N - 1 - k) * F.ifactorial(k) F.comb(N, k) * F.factorial(N - 1) * F.ifactorial(N - 1 - k) F.comb(N, k) * F.factorial(N - 1) F.comb(N, k) F.comb F comb N k F.factorial(N - 1) F.factorial F factorial N - 1 N 1 F.ifactorial(N - 1 - k) F.ifactorial F ifactorial N - 1 - k N - 1 N 1 k F.ifactorial(k) F.ifactorial F ifactorial k ans += (tmp % MOD) ans tmp % MOD tmp MOD ans %= MOD ans MOD print (ans) print ans ans = 0 0 ans K = min(K, N - 1) min(K, N - 1) K ans %= MOD MOD ans class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0 class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0 Factorial ans += (tmp % MOD) tmp % MOD ans K = map(int, input().split()) map(int, input().split()) K N, K = map(int, input().split()) map(int, input().split()) N F = Factorial(N + 1, MOD) Factorial(N + 1, MOD) F tmp = F.comb(N, k) * F.factorial(N - 1) * F.ifactorial(N - 1 - k) * F.ifactorial(k) F.comb(N, k) * F.factorial(N - 1) * F.ifactorial(N - 1 - k) * F.ifactorial(k) tmp MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD
MOD = 10 ** 9 + 7

class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0


N, K = map(int, input().split())

K = min(K, N - 1)

F = Factorial(N + 1, MOD)

ans = 0
for k in range(K + 1):
    tmp = F.comb(N, k) * F.factorial(N - 1) * F.ifactorial(N - 1 - k) * F.ifactorial(k)
    ans += (tmp % MOD)
    ans %= MOD

print (ans)