n, k = map(int, input().split())

mod = 10 ** 9 + 7
'''
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, n+1):
    fac.append(fac[-1] * i % mod)
    inv.append(-inv[mod%i] * (mod // i) % mod)
    finv.append(finv[-1] * inv[-1] % mod)
'''
fac = [1]
finv = [0]*(n+4)
for i in range(n+3):
    fac.append(fac[-1]*(i+1)%mod)

finv[-1] = pow(fac[-1],mod-2,mod)
for i in range(n+2,-1,-1):
    finv[i] = finv[i+1]*(i+1)%mod

ans = 0
for i in range(min(n-1, k) + 1):
    com1 = fac[n] * finv[i] * finv[n-i] % mod
    com2 = fac[n-1] * finv[i] * finv[n-i-1] % mod
    mul = com1 * com2 % mod
    ans = (ans + mul) % 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 '''
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, n+1):
    fac.append(fac[-1] * i % mod)
    inv.append(-inv[mod%i] * (mod // i) % mod)
    finv.append(finv[-1] * inv[-1] % mod)
''' fac = [1] fac [1] 1 finv = [0]*(n+4) finv [0]*(n+4) [0] 0 n+4 n 4 for i in range(n+3):
    fac.append(fac[-1]*(i+1)%mod) i range(n+3) range n+3 n 3 fac.append(fac[-1]*(i+1)%mod) fac.append fac append fac[-1]*(i+1)%mod fac[-1]*(i+1) fac[-1] fac -1 i+1 i 1 mod finv[-1] = pow(fac[-1],mod-2,mod) finv[-1] finv -1 pow(fac[-1],mod-2,mod) pow fac[-1] fac -1 mod-2 mod 2 mod for i in range(n+2,-1,-1):
    finv[i] = finv[i+1]*(i+1)%mod i range(n+2,-1,-1) range n+2 n 2 -1 -1 finv[i] = finv[i+1]*(i+1)%mod finv[i] finv i finv[i+1]*(i+1)%mod finv[i+1]*(i+1) finv[i+1] finv i+1 i 1 i+1 i 1 mod ans = 0 ans 0 for i in range(min(n-1, k) + 1):
    com1 = fac[n] * finv[i] * finv[n-i] % mod
    com2 = fac[n-1] * finv[i] * finv[n-i-1] % mod
    mul = com1 * com2 % mod
    ans = (ans + mul) % mod i range(min(n-1, k) + 1) range min(n-1, k) + 1 min(n-1, k) min n-1 n 1 k 1 com1 = fac[n] * finv[i] * finv[n-i] % mod com1 fac[n] * finv[i] * finv[n-i] % mod fac[n] * finv[i] * finv[n-i] fac[n] * finv[i] fac[n] fac n finv[i] finv i finv[n-i] finv n-i n i mod com2 = fac[n-1] * finv[i] * finv[n-i-1] % mod com2 fac[n-1] * finv[i] * finv[n-i-1] % mod fac[n-1] * finv[i] * finv[n-i-1] fac[n-1] * finv[i] fac[n-1] fac n-1 n 1 finv[i] finv i finv[n-i-1] finv n-i-1 n-i n i 1 mod mul = com1 * com2 % mod mul com1 * com2 % mod com1 * com2 com1 com2 mod ans = (ans + mul) % mod ans (ans + mul) % mod ans + mul ans mul mod print(ans) print ans com1 = fac[n] * finv[i] * finv[n-i] % mod fac[n] * finv[i] * finv[n-i] % mod com1 mul = com1 * com2 % mod com1 * com2 % mod mul finv = [0]*(n+4) [0]*(n+4) finv n, k = map(int, input().split()) map(int, input().split()) n fac = [1] [1] fac ans = 0 0 ans ans = (ans + mul) % mod (ans + mul) % mod ans k = map(int, input().split()) map(int, input().split()) k mod = 10 ** 9 + 7 10 ** 9 + 7 mod com2 = fac[n-1] * finv[i] * finv[n-i-1] % mod fac[n-1] * finv[i] * finv[n-i-1] % mod com2
n, k = map(int, input().split())

mod = 10 ** 9 + 7
'''
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, n+1):
    fac.append(fac[-1] * i % mod)
    inv.append(-inv[mod%i] * (mod // i) % mod)
    finv.append(finv[-1] * inv[-1] % mod)
'''
fac = [1]
finv = [0]*(n+4)
for i in range(n+3):
    fac.append(fac[-1]*(i+1)%mod)

finv[-1] = pow(fac[-1],mod-2,mod)
for i in range(n+2,-1,-1):
    finv[i] = finv[i+1]*(i+1)%mod

ans = 0
for i in range(min(n-1, k) + 1):
    com1 = fac[n] * finv[i] * finv[n-i] % mod
    com2 = fac[n-1] * finv[i] * finv[n-i-1] % mod
    mul = com1 * com2 % mod
    ans = (ans + mul) % mod

print(ans)