import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

N, K = map(int, input().split())
MOD = 10 ** 9 + 7

# 階乗、Combinationコンビネーション(numpyを使う)


def cumprod(arr, MOD):
    L = len(arr)
    Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]
        arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]
        arr[n] %= MOD
    return arr.ravel()[:L]


def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64)
    x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64)
    x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv


U = 10**6
fact, fact_inv = make_fact(N * 2 + 10, MOD)
fact, fact_inv = fact.tolist(), fact_inv.tolist()


def mod_comb_k(n, k, mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod


ans = 0
for i in range(N):
    if K < i:
        continue

    if N - 1 <= K:
        ans = mod_comb_k(N + N - 1, N - 1, MOD)
        break

    if i == 0:
        ans += 1
        continue

    a = int(mod_comb_k(N - 1, i, MOD)) * int(mod_comb_k(N, i, MOD))
    a %= MOD
    ans += a
    ans %= MOD

    '''
    a = int(fact[N]) * int(fact_inv[i]) % MOD * int(fact_inv[N - 1])
    a = a * int(fact[N-1]) % MOD * int(fact_inv[i]) % MOD * \
        int(fact_inv[N-i-1]) % MOD
    ans = (a + ans) % MOD
    '''

print(ans) import sys sys import numpy as np numpy sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 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 def cumprod(arr, MOD):
    L = len(arr)
    Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]
        arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]
        arr[n] %= MOD
    return arr.ravel()[:L] cumprod L = len(arr) L len(arr) len arr Lsq = int(L**.5+1) Lsq int(L**.5+1) int L**.5+1 L**.5 L .5 1 arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq) arr np.resize(arr, Lsq**2).reshape(Lsq, Lsq) np.resize(arr, Lsq**2).reshape np.resize(arr, Lsq**2) np.resize np resize arr Lsq**2 Lsq 2 reshape Lsq Lsq for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]
        arr[:, n] %= MOD
     n range(1, Lsq) range 1 Lsq arr[:, n] *= arr[:, n-1] arr[:, n] arr : arr[:, n-1] arr : arr[:, n] %= MOD arr[:, n] arr : MOD for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]
        arr[n] %= MOD
     n range(1, Lsq) range 1 Lsq arr[n] *= arr[n-1, -1] arr[n] arr n arr[n-1, -1] arr n-1 n 1 arr[n] %= MOD arr[n] arr n MOD return arr.ravel()[:L] arr.ravel()[:L] arr.ravel() arr.ravel arr ravel :L L arr arr MOD MOD def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64)
    x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64)
    x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv make_fact x = np.arange(U, dtype=np.int64) x np.arange(U, dtype=np.int64) np.arange np arange U dtype=np.int64 dtype np.int64 np int64 x[0] = 1 x[0] x 0 1 fact = cumprod(x, MOD) fact cumprod(x, MOD) cumprod x MOD x = np.arange(U, 0, -1, dtype=np.int64) x np.arange(U, 0, -1, dtype=np.int64) np.arange np arange U 0 -1 dtype=np.int64 dtype np.int64 np int64 x[0] = pow(int(fact[-1]), MOD-2, MOD) x[0] x 0 pow(int(fact[-1]), MOD-2, MOD) pow int(fact[-1]) int fact[-1] fact -1 MOD-2 MOD 2 MOD fact_inv = cumprod(x, MOD)[::-1] fact_inv cumprod(x, MOD)[::-1] (x, MOD) cumprod x MOD ::-1 -1 return fact, fact_inv return fact, fact_inv fact fact_inv U U MOD MOD U = 10**6 U 10**6 10 6 fact, fact_inv = make_fact(N * 2 + 10, MOD) fact make_fact(N * 2 + 10, MOD) make_fact N * 2 + 10 N * 2 N 2 10 MOD fact_inv fact, fact_inv = fact.tolist(), fact_inv.tolist() fact fact.tolist() fact.tolist fact tolist fact_inv fact_inv.tolist() fact_inv.tolist fact_inv tolist def mod_comb_k(n, k, mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod mod_comb_k return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod fact[n] * fact_inv[k] % mod * fact_inv[n - k] fact[n] * fact_inv[k] % mod fact[n] * fact_inv[k] fact[n] fact n fact_inv[k] fact_inv k mod fact_inv[n - k] fact_inv n - k n k mod n n k k mod mod ans = 0 ans 0 for i in range(N):
    if K < i:
        continue

    if N - 1 <= K:
        ans = mod_comb_k(N + N - 1, N - 1, MOD)
        break

    if i == 0:
        ans += 1
        continue

    a = int(mod_comb_k(N - 1, i, MOD)) * int(mod_comb_k(N, i, MOD))
    a %= MOD
    ans += a
    ans %= MOD

    '''
    a = int(fact[N]) * int(fact_inv[i]) % MOD * int(fact_inv[N - 1])
    a = a * int(fact[N-1]) % MOD * int(fact_inv[i]) % MOD * \
        int(fact_inv[N-i-1]) % MOD
    ans = (a + ans) % MOD
    ''' i range(N) range N if K < i:
        continue

     K < i K i continue if N - 1 <= K:
        ans = mod_comb_k(N + N - 1, N - 1, MOD)
        break

     N - 1 <= K N - 1 N 1 K ans = mod_comb_k(N + N - 1, N - 1, MOD) ans mod_comb_k(N + N - 1, N - 1, MOD) mod_comb_k N + N - 1 N + N N N 1 N - 1 N 1 MOD break if i == 0:
        ans += 1
        continue

     i == 0 i 0 ans += 1 ans 1 continue a = int(mod_comb_k(N - 1, i, MOD)) * int(mod_comb_k(N, i, MOD)) a int(mod_comb_k(N - 1, i, MOD)) * int(mod_comb_k(N, i, MOD)) int(mod_comb_k(N - 1, i, MOD)) int mod_comb_k(N - 1, i, MOD) mod_comb_k N - 1 N 1 i MOD int(mod_comb_k(N, i, MOD)) int mod_comb_k(N, i, MOD) mod_comb_k N i MOD a %= MOD a MOD ans += a ans a ans %= MOD ans MOD '''
    a = int(fact[N]) * int(fact_inv[i]) % MOD * int(fact_inv[N - 1])
    a = a * int(fact[N-1]) % MOD * int(fact_inv[i]) % MOD * \
        int(fact_inv[N-i-1]) % MOD
    ans = (a + ans) % MOD
    ''' print(ans) print ans ans = mod_comb_k(N + N - 1, N - 1, MOD) mod_comb_k(N + N - 1, N - 1, MOD) ans def mod_comb_k(n, k, mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod def mod_comb_k(n, k, mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod mod_comb_k a %= MOD MOD a ans %= MOD MOD ans K = map(int, input().split()) map(int, input().split()) K U = 10**6 10**6 U fact_inv = fact.tolist(), fact_inv.tolist() fact_inv.tolist() fact_inv def cumprod(arr, MOD):
    L = len(arr)
    Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]
        arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]
        arr[n] %= MOD
    return arr.ravel()[:L] def cumprod(arr, MOD):
    L = len(arr)
    Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]
        arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]
        arr[n] %= MOD
    return arr.ravel()[:L] cumprod N, K = map(int, input().split()) map(int, input().split()) N fact, fact_inv = fact.tolist(), fact_inv.tolist() fact.tolist() fact ans += a a ans fact_inv = make_fact(N * 2 + 10, MOD) make_fact(N * 2 + 10, MOD) fact_inv ans = 0 0 ans a = int(mod_comb_k(N - 1, i, MOD)) * int(mod_comb_k(N, i, MOD)) int(mod_comb_k(N - 1, i, MOD)) * int(mod_comb_k(N, i, MOD)) a ans += 1 1 ans def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64)
    x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64)
    x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64)
    x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64)
    x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv make_fact fact, fact_inv = make_fact(N * 2 + 10, MOD) make_fact(N * 2 + 10, MOD) fact MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD
import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

N, K = map(int, input().split())
MOD = 10 ** 9 + 7

# 階乗、Combinationコンビネーション(numpyを使う)


def cumprod(arr, MOD):
    L = len(arr)
    Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]
        arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]
        arr[n] %= MOD
    return arr.ravel()[:L]


def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64)
    x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64)
    x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv


U = 10**6
fact, fact_inv = make_fact(N * 2 + 10, MOD)
fact, fact_inv = fact.tolist(), fact_inv.tolist()


def mod_comb_k(n, k, mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod


ans = 0
for i in range(N):
    if K < i:
        continue

    if N - 1 <= K:
        ans = mod_comb_k(N + N - 1, N - 1, MOD)
        break

    if i == 0:
        ans += 1
        continue

    a = int(mod_comb_k(N - 1, i, MOD)) * int(mod_comb_k(N, i, MOD))
    a %= MOD
    ans += a
    ans %= MOD

    '''
    a = int(fact[N]) * int(fact_inv[i]) % MOD * int(fact_inv[N - 1])
    a = a * int(fact[N-1]) % MOD * int(fact_inv[i]) % MOD * \
        int(fact_inv[N-i-1]) % MOD
    ans = (a + ans) % MOD
    '''

print(ans)
