import math

def modcomb(n, k, mod, fac, ifac):
    x = fac[n]
    y = ifac[n-k] * ifac[k] % mod
    #print(x * y % mod)
    return x * y % mod

def makeTables(n, mod):
    fac = [1, 1]
    ifac = [1, 1]
    inv = [0, 1]

    for i in range(2, n+1):
        fac.append(i * fac[i-1] % mod)
        inv.append(-inv[mod % i] * (mod // i) % mod)
        ifac.append(inv[i] * ifac[i-1] % mod)
    return fac, ifac

def answer(n, k, mod, fac, ifac):
    if k >= n:
        k = n - 1
    ans = 0
    for i in range(k+1):
        c = modcomb(n, i, mod, fac, ifac) * modcomb(n-1, i, mod, fac, ifac) % mod
        ans = (ans + c) % mod

    return ans

n, k = map(int, input().split())
mod = 1000000007

fac, ifac = makeTables(n, mod)
print(answer(n, k, mod, fac, ifac)) import math math def modcomb(n, k, mod, fac, ifac):
    x = fac[n]
    y = ifac[n-k] * ifac[k] % mod
    #print(x * y % mod)
    return x * y % mod modcomb x = fac[n] x fac[n] fac n y = ifac[n-k] * ifac[k] % mod y ifac[n-k] * ifac[k] % mod ifac[n-k] * ifac[k] ifac[n-k] ifac n-k n k ifac[k] ifac k mod return x * y % mod x * y % mod x * y x y mod n n k k mod mod fac fac ifac ifac def makeTables(n, mod):
    fac = [1, 1]
    ifac = [1, 1]
    inv = [0, 1]

    for i in range(2, n+1):
        fac.append(i * fac[i-1] % mod)
        inv.append(-inv[mod % i] * (mod // i) % mod)
        ifac.append(inv[i] * ifac[i-1] % mod)
    return fac, ifac makeTables fac = [1, 1] fac [1, 1] 1 1 ifac = [1, 1] ifac [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, n+1):
        fac.append(i * fac[i-1] % mod)
        inv.append(-inv[mod % i] * (mod // i) % mod)
        ifac.append(inv[i] * ifac[i-1] % mod)
     i range(2, n+1) range 2 n+1 n 1 fac.append(i * fac[i-1] % mod) fac.append fac append i * fac[i-1] % mod i * fac[i-1] i fac[i-1] fac i-1 i 1 mod inv.append(-inv[mod % i] * (mod // i) % mod) inv.append inv append -inv[mod % i] * (mod // i) % mod -inv[mod % i] * (mod // i) -inv[mod % i] inv[mod % i] inv mod % i mod i mod // i mod i mod ifac.append(inv[i] * ifac[i-1] % mod) ifac.append ifac append inv[i] * ifac[i-1] % mod inv[i] * ifac[i-1] inv[i] inv i ifac[i-1] ifac i-1 i 1 mod return fac, ifac return fac, ifac fac ifac n n mod mod def answer(n, k, mod, fac, ifac):
    if k >= n:
        k = n - 1
    ans = 0
    for i in range(k+1):
        c = modcomb(n, i, mod, fac, ifac) * modcomb(n-1, i, mod, fac, ifac) % mod
        ans = (ans + c) % mod

    return ans answer if k >= n:
        k = n - 1
     k >= n k n k = n - 1 k n - 1 n 1 ans = 0 ans 0 for i in range(k+1):
        c = modcomb(n, i, mod, fac, ifac) * modcomb(n-1, i, mod, fac, ifac) % mod
        ans = (ans + c) % mod

     i range(k+1) range k+1 k 1 c = modcomb(n, i, mod, fac, ifac) * modcomb(n-1, i, mod, fac, ifac) % mod c modcomb(n, i, mod, fac, ifac) * modcomb(n-1, i, mod, fac, ifac) % mod modcomb(n, i, mod, fac, ifac) * modcomb(n-1, i, mod, fac, ifac) modcomb(n, i, mod, fac, ifac) modcomb n i mod fac ifac modcomb(n-1, i, mod, fac, ifac) modcomb n-1 n 1 i mod fac ifac mod ans = (ans + c) % mod ans (ans + c) % mod ans + c ans c mod return ans ans n n k k mod mod fac fac ifac ifac n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k mod = 1000000007 mod 1000000007 fac, ifac = makeTables(n, mod) fac makeTables(n, mod) makeTables n mod ifac print(answer(n, k, mod, fac, ifac)) print answer(n, k, mod, fac, ifac) answer n k mod fac ifac n, k = map(int, input().split()) map(int, input().split()) n fac, ifac = makeTables(n, mod) makeTables(n, mod) fac def makeTables(n, mod):
    fac = [1, 1]
    ifac = [1, 1]
    inv = [0, 1]

    for i in range(2, n+1):
        fac.append(i * fac[i-1] % mod)
        inv.append(-inv[mod % i] * (mod // i) % mod)
        ifac.append(inv[i] * ifac[i-1] % mod)
    return fac, ifac def makeTables(n, mod):
    fac = [1, 1]
    ifac = [1, 1]
    inv = [0, 1]

    for i in range(2, n+1):
        fac.append(i * fac[i-1] % mod)
        inv.append(-inv[mod % i] * (mod // i) % mod)
        ifac.append(inv[i] * ifac[i-1] % mod)
    return fac, ifac makeTables ifac = makeTables(n, mod) makeTables(n, mod) ifac def answer(n, k, mod, fac, ifac):
    if k >= n:
        k = n - 1
    ans = 0
    for i in range(k+1):
        c = modcomb(n, i, mod, fac, ifac) * modcomb(n-1, i, mod, fac, ifac) % mod
        ans = (ans + c) % mod

    return ans def answer(n, k, mod, fac, ifac):
    if k >= n:
        k = n - 1
    ans = 0
    for i in range(k+1):
        c = modcomb(n, i, mod, fac, ifac) * modcomb(n-1, i, mod, fac, ifac) % mod
        ans = (ans + c) % mod

    return ans answer k = map(int, input().split()) map(int, input().split()) k mod = 1000000007 1000000007 mod def modcomb(n, k, mod, fac, ifac):
    x = fac[n]
    y = ifac[n-k] * ifac[k] % mod
    #print(x * y % mod)
    return x * y % mod def modcomb(n, k, mod, fac, ifac):
    x = fac[n]
    y = ifac[n-k] * ifac[k] % mod
    #print(x * y % mod)
    return x * y % mod modcomb
import math

def modcomb(n, k, mod, fac, ifac):
    x = fac[n]
    y = ifac[n-k] * ifac[k] % mod
    #print(x * y % mod)
    return x * y % mod

def makeTables(n, mod):
    fac = [1, 1]
    ifac = [1, 1]
    inv = [0, 1]

    for i in range(2, n+1):
        fac.append(i * fac[i-1] % mod)
        inv.append(-inv[mod % i] * (mod // i) % mod)
        ifac.append(inv[i] * ifac[i-1] % mod)
    return fac, ifac

def answer(n, k, mod, fac, ifac):
    if k >= n:
        k = n - 1
    ans = 0
    for i in range(k+1):
        c = modcomb(n, i, mod, fac, ifac) * modcomb(n-1, i, mod, fac, ifac) % mod
        ans = (ans + c) % mod

    return ans

n, k = map(int, input().split())
mod = 1000000007

fac, ifac = makeTables(n, mod)
print(answer(n, k, mod, fac, ifac))
