n, k = map(int, input().split())
mod = 10**9 + 7

m = 4*10**5 + 500

fac = [1] * (m + 1)
facinv = [1] * (m + 1)
for i in range(1, m+1):
    fac[i] = (fac[i-1] * i) % mod
    facinv[i] = (facinv[i-1] * pow(i, -1, mod)) % mod

def nCk(n, k):
    return (fac[n] * facinv[k] * facinv[n-k]) % mod

if k > (n - 2):
    print(nCk(2*n-1, n))
else:
    ans = 0
    for i in range(k+1):
        ans = (ans + nCk(n-1, i) * nCk(n, i)) % 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 m = 4*10**5 + 500 m 4*10**5 + 500 4*10**5 4 10**5 10 5 500 fac = [1] * (m + 1) fac [1] * (m + 1) [1] 1 m + 1 m 1 facinv = [1] * (m + 1) facinv [1] * (m + 1) [1] 1 m + 1 m 1 for i in range(1, m+1):
    fac[i] = (fac[i-1] * i) % mod
    facinv[i] = (facinv[i-1] * pow(i, -1, mod)) % mod i range(1, m+1) range 1 m+1 m 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 facinv[i] = (facinv[i-1] * pow(i, -1, mod)) % mod facinv[i] facinv i (facinv[i-1] * pow(i, -1, mod)) % mod facinv[i-1] * pow(i, -1, mod) facinv[i-1] facinv i-1 i 1 pow(i, -1, mod) pow i -1 mod mod def nCk(n, k):
    return (fac[n] * facinv[k] * facinv[n-k]) % mod nCk return (fac[n] * facinv[k] * facinv[n-k]) % mod (fac[n] * facinv[k] * facinv[n-k]) % mod fac[n] * facinv[k] * facinv[n-k] fac[n] * facinv[k] fac[n] fac n facinv[k] facinv k facinv[n-k] facinv n-k n k mod n n k k if k > (n - 2):
    print(nCk(2*n-1, n))
else:
    ans = 0
    for i in range(k+1):
        ans = (ans + nCk(n-1, i) * nCk(n, i)) % mod
    print(ans) k > (n - 2) k n - 2 n 2 print(nCk(2*n-1, n)) print nCk(2*n-1, n) nCk 2*n-1 2*n 2 n 1 n ans = 0 ans 0 for i in range(k+1):
        ans = (ans + nCk(n-1, i) * nCk(n, i)) % mod
     i range(k+1) range k+1 k 1 ans = (ans + nCk(n-1, i) * nCk(n, i)) % mod ans (ans + nCk(n-1, i) * nCk(n, i)) % mod ans + nCk(n-1, i) * nCk(n, i) ans nCk(n-1, i) * nCk(n, i) nCk(n-1, i) nCk n-1 n 1 i nCk(n, i) nCk n i mod print(ans) print ans n, k = map(int, input().split()) map(int, input().split()) n fac = [1] * (m + 1) [1] * (m + 1) fac m = 4*10**5 + 500 4*10**5 + 500 m mod = 10**9 + 7 10**9 + 7 mod ans = 0 0 ans def nCk(n, k):
    return (fac[n] * facinv[k] * facinv[n-k]) % mod def nCk(n, k):
    return (fac[n] * facinv[k] * facinv[n-k]) % mod nCk k = map(int, input().split()) map(int, input().split()) k ans = (ans + nCk(n-1, i) * nCk(n, i)) % mod (ans + nCk(n-1, i) * nCk(n, i)) % mod ans facinv = [1] * (m + 1) [1] * (m + 1) facinv
n, k = map(int, input().split())
mod = 10**9 + 7

m = 4*10**5 + 500

fac = [1] * (m + 1)
facinv = [1] * (m + 1)
for i in range(1, m+1):
    fac[i] = (fac[i-1] * i) % mod
    facinv[i] = (facinv[i-1] * pow(i, -1, mod)) % mod

def nCk(n, k):
    return (fac[n] * facinv[k] * facinv[n-k]) % mod

if k > (n - 2):
    print(nCk(2*n-1, n))
else:
    ans = 0
    for i in range(k+1):
        ans = (ans + nCk(n-1, i) * nCk(n, i)) % mod
    print(ans)