import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


def comb(n, k):
    if n < 0 or n < k or k < 0:
        return 0
    return fac[n] * ifac[k] * ifac[n - k] % mod


n, k = map(int, read().split())
mod = 10 ** 9 + 7
max_n = 2 * 10 ** 5 + 1
ans = 0
fac = [1] * max_n
inv = [1] * max_n
ifac = [1] * max_n
for i in range(2, max_n):
    fac[i] = fac[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    ifac[i] = ifac[i - 1] * inv[i] % mod

for i in range(min(n, k) + 1):
    ans += comb(n, i) * comb(n - 1, i)
    ans %= mod
print(ans) import sys sys read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 def comb(n, k):
    if n < 0 or n < k or k < 0:
        return 0
    return fac[n] * ifac[k] * ifac[n - k] % mod comb if n < 0 or n < k or k < 0:
        return 0
     n < 0 or n < k or k < 0 n < 0 or n < k n < 0 n 0 n < k n k k < 0 k 0 return 0 0 return fac[n] * ifac[k] * ifac[n - k] % mod fac[n] * ifac[k] * ifac[n - k] % mod fac[n] * ifac[k] * ifac[n - k] fac[n] * ifac[k] fac[n] fac n ifac[k] ifac k ifac[n - k] ifac n - k n k mod n n k k n, k = map(int, read().split()) n map(int, read().split()) map int read().split() ().split () read split k mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 max_n = 2 * 10 ** 5 + 1 max_n 2 * 10 ** 5 + 1 2 * 10 ** 5 2 10 ** 5 10 5 1 ans = 0 ans 0 fac = [1] * max_n fac [1] * max_n [1] 1 max_n inv = [1] * max_n inv [1] * max_n [1] 1 max_n ifac = [1] * max_n ifac [1] * max_n [1] 1 max_n for i in range(2, max_n):
    fac[i] = fac[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    ifac[i] = ifac[i - 1] * inv[i] % mod i range(2, max_n) range 2 max_n fac[i] = fac[i - 1] * i % mod fac[i] fac i fac[i - 1] * i % mod fac[i - 1] * i fac[i - 1] fac i - 1 i 1 i mod inv[i] = mod - inv[mod % i] * (mod // i) % mod inv[i] inv i mod - inv[mod % i] * (mod // i) % mod mod inv[mod % i] * (mod // i) % mod inv[mod % i] * (mod // i) inv[mod % i] inv mod % i mod i mod // i mod i mod ifac[i] = ifac[i - 1] * inv[i] % mod ifac[i] ifac i ifac[i - 1] * inv[i] % mod ifac[i - 1] * inv[i] ifac[i - 1] ifac i - 1 i 1 inv[i] inv i mod for i in range(min(n, k) + 1):
    ans += comb(n, i) * comb(n - 1, i)
    ans %= mod i range(min(n, k) + 1) range min(n, k) + 1 min(n, k) min n k 1 ans += comb(n, i) * comb(n - 1, i) ans comb(n, i) * comb(n - 1, i) comb(n, i) comb n i comb(n - 1, i) comb n - 1 n 1 i ans %= mod ans mod print(ans) print ans ans += comb(n, i) * comb(n - 1, i) comb(n, i) * comb(n - 1, i) ans read = sys.stdin.buffer.read sys.stdin.buffer.read read readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines ifac = [1] * max_n [1] * max_n ifac inv = [1] * max_n [1] * max_n inv def comb(n, k):
    if n < 0 or n < k or k < 0:
        return 0
    return fac[n] * ifac[k] * ifac[n - k] % mod def comb(n, k):
    if n < 0 or n < k or k < 0:
        return 0
    return fac[n] * ifac[k] * ifac[n - k] % mod comb ans %= mod mod ans readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline max_n = 2 * 10 ** 5 + 1 2 * 10 ** 5 + 1 max_n n, k = map(int, read().split()) map(int, read().split()) n k = map(int, read().split()) map(int, read().split()) k fac = [1] * max_n [1] * max_n fac mod = 10 ** 9 + 7 10 ** 9 + 7 mod ans = 0 0 ans
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


def comb(n, k):
    if n < 0 or n < k or k < 0:
        return 0
    return fac[n] * ifac[k] * ifac[n - k] % mod


n, k = map(int, read().split())
mod = 10 ** 9 + 7
max_n = 2 * 10 ** 5 + 1
ans = 0
fac = [1] * max_n
inv = [1] * max_n
ifac = [1] * max_n
for i in range(2, max_n):
    fac[i] = fac[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    ifac[i] = ifac[i - 1] * inv[i] % mod

for i in range(min(n, k) + 1):
    ans += comb(n, i) * comb(n - 1, i)
    ans %= mod
print(ans)
