N, K = map(int, open(0).read().split())

MAX = 5 * 10 ** 5
MOD = 10 ** 9 + 7

# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1
for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    
# Inverse factorial
finv = [0] * (MAX + 1)
finv[MAX] = pow(fac[MAX], MOD - 2, MOD)
for i in reversed(range(1, MAX + 1)):
    finv[i - 1] = finv[i] * i % MOD

def comb(n, k):
    return fac[n] * finv[n - k] * finv[k]

def rep_perm(n, k):
    return comb(n + k - 1, k)

ans = 0
for k in range(0, min(N, K + 1)):
    ans += comb(N, k) * rep_perm(N - k, k)
    ans %= MOD
print(ans) N, K = map(int, open(0).read().split()) N map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split K MAX = 5 * 10 ** 5 MAX 5 * 10 ** 5 5 10 ** 5 10 5 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 fac = [0] * (MAX + 1) fac [0] * (MAX + 1) [0] 0 MAX + 1 MAX 1 fac[0] = 1 fac[0] fac 0 1 fac[1] = 1 fac[1] fac 1 1 for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    
# Inverse factorial i range(2, MAX + 1) range 2 MAX + 1 MAX 1 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 finv = [0] * (MAX + 1) finv [0] * (MAX + 1) [0] 0 MAX + 1 MAX 1 finv[MAX] = pow(fac[MAX], MOD - 2, MOD) finv[MAX] finv MAX pow(fac[MAX], MOD - 2, MOD) pow fac[MAX] fac MAX MOD - 2 MOD 2 MOD for i in reversed(range(1, MAX + 1)):
    finv[i - 1] = finv[i] * i % MOD i reversed(range(1, MAX + 1)) reversed range(1, MAX + 1) range 1 MAX + 1 MAX 1 finv[i - 1] = finv[i] * i % MOD finv[i - 1] finv i - 1 i 1 finv[i] * i % MOD finv[i] * i finv[i] finv i i MOD def comb(n, k):
    return fac[n] * finv[n - k] * finv[k] comb return fac[n] * finv[n - k] * finv[k] fac[n] * finv[n - k] * finv[k] fac[n] * finv[n - k] fac[n] fac n finv[n - k] finv n - k n k finv[k] finv k n n k k def rep_perm(n, k):
    return comb(n + k - 1, k) rep_perm return comb(n + k - 1, k) comb(n + k - 1, k) comb n + k - 1 n + k n k 1 k n n k k ans = 0 ans 0 for k in range(0, min(N, K + 1)):
    ans += comb(N, k) * rep_perm(N - k, k)
    ans %= MOD k range(0, min(N, K + 1)) range 0 min(N, K + 1) min N K + 1 K 1 ans += comb(N, k) * rep_perm(N - k, k) ans comb(N, k) * rep_perm(N - k, k) comb(N, k) comb N k rep_perm(N - k, k) rep_perm N - k N k k ans %= MOD ans MOD print(ans) print ans MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD ans %= MOD MOD ans K = map(int, open(0).read().split()) map(int, open(0).read().split()) K def comb(n, k):
    return fac[n] * finv[n - k] * finv[k] def comb(n, k):
    return fac[n] * finv[n - k] * finv[k] comb def rep_perm(n, k):
    return comb(n + k - 1, k) def rep_perm(n, k):
    return comb(n + k - 1, k) rep_perm ans = 0 0 ans ans += comb(N, k) * rep_perm(N - k, k) comb(N, k) * rep_perm(N - k, k) ans MAX = 5 * 10 ** 5 5 * 10 ** 5 MAX fac = [0] * (MAX + 1) [0] * (MAX + 1) fac finv = [0] * (MAX + 1) [0] * (MAX + 1) finv N, K = map(int, open(0).read().split()) map(int, open(0).read().split()) N
N, K = map(int, open(0).read().split())

MAX = 5 * 10 ** 5
MOD = 10 ** 9 + 7

# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1
for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    
# Inverse factorial
finv = [0] * (MAX + 1)
finv[MAX] = pow(fac[MAX], MOD - 2, MOD)
for i in reversed(range(1, MAX + 1)):
    finv[i - 1] = finv[i] * i % MOD

def comb(n, k):
    return fac[n] * finv[n - k] * finv[k]

def rep_perm(n, k):
    return comb(n + k - 1, k)

ans = 0
for k in range(0, min(N, K + 1)):
    ans += comb(N, k) * rep_perm(N - k, k)
    ans %= MOD
print(ans)
