N, K = map(int, input().split())
MOD = 10**9 + 7
MAX_N = 10**6 + 5
fact = [0]*(MAX_N)
fact_inv = [0]*(MAX_N)
fact[0] = 1
for i in range(MAX_N-1):
    fact[i+1] = fact[i]*(i+1) % MOD
fact_inv[-1] = pow(fact[-1], MOD-2, MOD)
for i in range(MAX_N-2, -1, -1):
    fact_inv[i] = fact_inv[i+1]*(i+1) % MOD


def comb(n, k):
    return fact[n]*fact_inv[k] % MOD * fact_inv[n-k] % MOD


if K >= N:
    print(comb(2*N-1, N-1))
    exit()

ans = 1
for i in range(1, K+1):
    ans += comb(N, i)*comb(N-1, i) % MOD
    ans %= MOD
print(ans) 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 MAX_N = 10**6 + 5 MAX_N 10**6 + 5 10**6 10 6 5 fact = [0]*(MAX_N) fact [0]*(MAX_N) [0] 0 MAX_N fact_inv = [0]*(MAX_N) fact_inv [0]*(MAX_N) [0] 0 MAX_N fact[0] = 1 fact[0] fact 0 1 for i in range(MAX_N-1):
    fact[i+1] = fact[i]*(i+1) % MOD i range(MAX_N-1) range MAX_N-1 MAX_N 1 fact[i+1] = fact[i]*(i+1) % MOD fact[i+1] fact i+1 i 1 fact[i]*(i+1) % MOD fact[i]*(i+1) fact[i] fact i i+1 i 1 MOD fact_inv[-1] = pow(fact[-1], MOD-2, MOD) fact_inv[-1] fact_inv -1 pow(fact[-1], MOD-2, MOD) pow fact[-1] fact -1 MOD-2 MOD 2 MOD for i in range(MAX_N-2, -1, -1):
    fact_inv[i] = fact_inv[i+1]*(i+1) % MOD i range(MAX_N-2, -1, -1) range MAX_N-2 MAX_N 2 -1 -1 fact_inv[i] = fact_inv[i+1]*(i+1) % MOD fact_inv[i] fact_inv i fact_inv[i+1]*(i+1) % MOD fact_inv[i+1]*(i+1) fact_inv[i+1] fact_inv i+1 i 1 i+1 i 1 MOD def comb(n, k):
    return fact[n]*fact_inv[k] % MOD * fact_inv[n-k] % MOD comb 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 if K >= N:
    print(comb(2*N-1, N-1))
    exit() K >= N K N print(comb(2*N-1, N-1)) print comb(2*N-1, N-1) comb 2*N-1 2*N 2 N 1 N-1 N 1 exit() exit ans = 1 ans 1 for i in range(1, K+1):
    ans += comb(N, i)*comb(N-1, i) % MOD
    ans %= MOD i range(1, K+1) range 1 K+1 K 1 ans += comb(N, i)*comb(N-1, i) % MOD ans comb(N, i)*comb(N-1, i) % MOD comb(N, i)*comb(N-1, i) comb(N, i) comb N i comb(N-1, i) comb N-1 N 1 i MOD ans %= MOD ans MOD print(ans) print ans ans %= MOD MOD ans K = map(int, input().split()) map(int, input().split()) K def comb(n, k):
    return fact[n]*fact_inv[k] % MOD * fact_inv[n-k] % MOD def comb(n, k):
    return fact[n]*fact_inv[k] % MOD * fact_inv[n-k] % MOD comb MOD = 10**9 + 7 10**9 + 7 MOD ans += comb(N, i)*comb(N-1, i) % MOD comb(N, i)*comb(N-1, i) % MOD ans MAX_N = 10**6 + 5 10**6 + 5 MAX_N N, K = map(int, input().split()) map(int, input().split()) N ans = 1 1 ans fact = [0]*(MAX_N) [0]*(MAX_N) fact fact_inv = [0]*(MAX_N) [0]*(MAX_N) fact_inv
N, K = map(int, input().split())
MOD = 10**9 + 7
MAX_N = 10**6 + 5
fact = [0]*(MAX_N)
fact_inv = [0]*(MAX_N)
fact[0] = 1
for i in range(MAX_N-1):
    fact[i+1] = fact[i]*(i+1) % MOD
fact_inv[-1] = pow(fact[-1], MOD-2, MOD)
for i in range(MAX_N-2, -1, -1):
    fact_inv[i] = fact_inv[i+1]*(i+1) % MOD


def comb(n, k):
    return fact[n]*fact_inv[k] % MOD * fact_inv[n-k] % MOD


if K >= N:
    print(comb(2*N-1, N-1))
    exit()

ans = 1
for i in range(1, K+1):
    ans += comb(N, i)*comb(N-1, i) % MOD
    ans %= MOD
print(ans)
