# comb_mod(n, c, r, mod, fac, den) ≡ nCr
def prepare(n, mod):
    # fac[i] ≡ i!
    fac = [1]
    for i in range(1, n+1):
        fac.append((fac[-1] * i) % mod)

    # rec ≡ 1 / n!
    rec = pow(fac[-1], mod-2, mod)

    # den[i] ≡ 1 / i!
    den = [1 for _ in range(n+1)]
    den[n] = rec
    for i in range(n-1, 0, -1):
        rec = (rec * (i+1)) % mod
        den[i] = rec
    
    return fac, den

def comb_mod(n, r, mod, fac, den):
    return (fac[n] * den[r] * den[n - r]) % mod

n, k = map(int, input().split())
mod = 10**9 + 7
fac, den = prepare(2*n-1, mod)

if k >= n-1:
    print(comb_mod(2*n-1, n, mod, fac, den))
else:
    ans = 0
    for i in range(k+1):
        ans += comb_mod(n-1, i, mod, fac, den) * comb_mod(n, i, mod, fac, den)
        ans %= mod
    print(ans) def prepare(n, mod):
    # fac[i] ≡ i!
    fac = [1]
    for i in range(1, n+1):
        fac.append((fac[-1] * i) % mod)

    # rec ≡ 1 / n!
    rec = pow(fac[-1], mod-2, mod)

    # den[i] ≡ 1 / i!
    den = [1 for _ in range(n+1)]
    den[n] = rec
    for i in range(n-1, 0, -1):
        rec = (rec * (i+1)) % mod
        den[i] = rec
    
    return fac, den prepare fac = [1] fac [1] 1 for i in range(1, n+1):
        fac.append((fac[-1] * i) % mod)

    # rec ≡ 1 / n!
     i range(1, n+1) range 1 n+1 n 1 fac.append((fac[-1] * i) % mod) fac.append fac append (fac[-1] * i) % mod fac[-1] * i fac[-1] fac -1 i mod rec = pow(fac[-1], mod-2, mod) rec pow(fac[-1], mod-2, mod) pow fac[-1] fac -1 mod-2 mod 2 mod 1 for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) 1 den = [1 for _ in range(n+1)] den [1 for _ in range(n+1)] den[n] = rec den[n] den n rec for i in range(n-1, 0, -1):
        rec = (rec * (i+1)) % mod
        den[i] = rec
    
     i range(n-1, 0, -1) range n-1 n 1 0 -1 rec = (rec * (i+1)) % mod rec (rec * (i+1)) % mod rec * (i+1) rec i+1 i 1 mod den[i] = rec den[i] den i rec return fac, den return fac, den fac den n n mod mod def comb_mod(n, r, mod, fac, den):
    return (fac[n] * den[r] * den[n - r]) % mod comb_mod return (fac[n] * den[r] * den[n - r]) % mod (fac[n] * den[r] * den[n - r]) % mod fac[n] * den[r] * den[n - r] fac[n] * den[r] fac[n] fac n den[r] den r den[n - r] den n - r n r mod n n r r mod mod fac fac den den n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 fac, den = prepare(2*n-1, mod) fac prepare(2*n-1, mod) prepare 2*n-1 2*n 2 n 1 mod den if k >= n-1:
    print(comb_mod(2*n-1, n, mod, fac, den))
else:
    ans = 0
    for i in range(k+1):
        ans += comb_mod(n-1, i, mod, fac, den) * comb_mod(n, i, mod, fac, den)
        ans %= mod
    print(ans) k >= n-1 k n-1 n 1 print(comb_mod(2*n-1, n, mod, fac, den)) print comb_mod(2*n-1, n, mod, fac, den) comb_mod 2*n-1 2*n 2 n 1 n mod fac den ans = 0 ans 0 for i in range(k+1):
        ans += comb_mod(n-1, i, mod, fac, den) * comb_mod(n, i, mod, fac, den)
        ans %= mod
     i range(k+1) range k+1 k 1 ans += comb_mod(n-1, i, mod, fac, den) * comb_mod(n, i, mod, fac, den) ans comb_mod(n-1, i, mod, fac, den) * comb_mod(n, i, mod, fac, den) comb_mod(n-1, i, mod, fac, den) comb_mod n-1 n 1 i mod fac den comb_mod(n, i, mod, fac, den) comb_mod n i mod fac den ans %= mod ans mod print(ans) print ans n, k = map(int, input().split()) map(int, input().split()) n k = map(int, input().split()) map(int, input().split()) k ans += comb_mod(n-1, i, mod, fac, den) * comb_mod(n, i, mod, fac, den) comb_mod(n-1, i, mod, fac, den) * comb_mod(n, i, mod, fac, den) ans mod = 10**9 + 7 10**9 + 7 mod den = prepare(2*n-1, mod) prepare(2*n-1, mod) den def comb_mod(n, r, mod, fac, den):
    return (fac[n] * den[r] * den[n - r]) % mod def comb_mod(n, r, mod, fac, den):
    return (fac[n] * den[r] * den[n - r]) % mod comb_mod fac, den = prepare(2*n-1, mod) prepare(2*n-1, mod) fac def prepare(n, mod):
    # fac[i] ≡ i!
    fac = [1]
    for i in range(1, n+1):
        fac.append((fac[-1] * i) % mod)

    # rec ≡ 1 / n!
    rec = pow(fac[-1], mod-2, mod)

    # den[i] ≡ 1 / i!
    den = [1 for _ in range(n+1)]
    den[n] = rec
    for i in range(n-1, 0, -1):
        rec = (rec * (i+1)) % mod
        den[i] = rec
    
    return fac, den def prepare(n, mod):
    # fac[i] ≡ i!
    fac = [1]
    for i in range(1, n+1):
        fac.append((fac[-1] * i) % mod)

    # rec ≡ 1 / n!
    rec = pow(fac[-1], mod-2, mod)

    # den[i] ≡ 1 / i!
    den = [1 for _ in range(n+1)]
    den[n] = rec
    for i in range(n-1, 0, -1):
        rec = (rec * (i+1)) % mod
        den[i] = rec
    
    return fac, den prepare ans %= mod mod ans ans = 0 0 ans
# comb_mod(n, c, r, mod, fac, den) ≡ nCr
def prepare(n, mod):
    # fac[i] ≡ i!
    fac = [1]
    for i in range(1, n+1):
        fac.append((fac[-1] * i) % mod)

    # rec ≡ 1 / n!
    rec = pow(fac[-1], mod-2, mod)

    # den[i] ≡ 1 / i!
    den = [1 for _ in range(n+1)]
    den[n] = rec
    for i in range(n-1, 0, -1):
        rec = (rec * (i+1)) % mod
        den[i] = rec
    
    return fac, den

def comb_mod(n, r, mod, fac, den):
    return (fac[n] * den[r] * den[n - r]) % mod

n, k = map(int, input().split())
mod = 10**9 + 7
fac, den = prepare(2*n-1, mod)

if k >= n-1:
    print(comb_mod(2*n-1, n, mod, fac, den))
else:
    ans = 0
    for i in range(k+1):
        ans += comb_mod(n-1, i, mod, fac, den) * comb_mod(n, i, mod, fac, den)
        ans %= mod
    print(ans)