# nCk ( O(N) )
N_MAX = 10**6
MOD = 10**9 + 7
fac, finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX
def com_init():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, N_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

def com(n, k):
    if n < k: return 0
    if n < 0 or k < 0: return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

com_init()
n,k = map(int, input().split())
ans = 0
max_k = min(n-1,k)
for i in range(max_k+1):
    ans += (com(n,i)*com(n-1,i))
    ans%=MOD
print(ans) N_MAX = 10**6 N_MAX 10**6 10 6 MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 fac, finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX fac [0]*N_MAX [0] 0 N_MAX finv [0]*N_MAX [0] 0 N_MAX inv [0]*N_MAX [0] 0 N_MAX def com_init():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, N_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD com_init fac[0], fac[1] = 1, 1 fac[0] fac 0 1 fac[1] fac 1 1 finv[0], finv[1] = 1, 1 finv[0] finv 0 1 finv[1] finv 1 1 inv[1] = 1 inv[1] inv 1 1 for i in range(2, N_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD i range(2, N_MAX) range 2 N_MAX 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 finv[i] = finv[i - 1] * inv[i] % MOD finv[i] finv i finv[i - 1] * inv[i] % MOD finv[i - 1] * inv[i] finv[i - 1] finv i - 1 i 1 inv[i] inv i MOD def com(n, k):
    if n < k: return 0
    if n < 0 or k < 0: return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD com if n < k: return 0
     n < k n k if n < 0 or k < 0: return 0
     n < 0 or k < 0 n < 0 n 0 k < 0 k 0 return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD fac[n] * (finv[k] * finv[n - k] % MOD) % MOD fac[n] * (finv[k] * finv[n - k] % MOD) fac[n] fac n finv[k] * finv[n - k] % MOD finv[k] * finv[n - k] finv[k] finv k finv[n - k] finv n - k n k MOD MOD n n k k com_init() com_init n,k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k ans = 0 ans 0 max_k = min(n-1,k) max_k min(n-1,k) min n-1 n 1 k for i in range(max_k+1):
    ans += (com(n,i)*com(n-1,i))
    ans%=MOD i range(max_k+1) range max_k+1 max_k 1 ans += (com(n,i)*com(n-1,i)) ans com(n,i)*com(n-1,i) com(n,i) com n i com(n-1,i) com n-1 n 1 i ans%=MOD ans MOD print(ans) print ans N_MAX = 10**6 10**6 N_MAX def com_init():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, N_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD def com_init():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, N_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD com_init inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX [0]*N_MAX inv finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX [0]*N_MAX finv def com(n, k):
    if n < k: return 0
    if n < 0 or k < 0: return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD def com(n, k):
    if n < k: return 0
    if n < 0 or k < 0: return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD com k = map(int, input().split()) map(int, input().split()) k n,k = map(int, input().split()) map(int, input().split()) n fac, finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX [0]*N_MAX fac ans%=MOD MOD ans MOD = 10**9 + 7 10**9 + 7 MOD ans = 0 0 ans ans += (com(n,i)*com(n-1,i)) com(n,i)*com(n-1,i) ans max_k = min(n-1,k) min(n-1,k) max_k
# nCk ( O(N) )
N_MAX = 10**6
MOD = 10**9 + 7
fac, finv, inv = [0]*N_MAX ,[0]*N_MAX, [0]*N_MAX
def com_init():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, N_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

def com(n, k):
    if n < k: return 0
    if n < 0 or k < 0: return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

com_init()
n,k = map(int, input().split())
ans = 0
max_k = min(n-1,k)
for i in range(max_k+1):
    ans += (com(n,i)*com(n-1,i))
    ans%=MOD
print(ans)