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

def modcomb(n,a,mod):
    cnt = 1
    for i in range(a):
        cnt *= (n-i)
        cnt *= pow(i+1,mod-2,mod)
        cnt %= mod
    # print(cnt)
    return cnt

def modconb(n,mod):
    # テーブルを作る
    fac = [0]*(n+1)
    finv = [0]*(n+1)
    inv = [0]*(n+1)  

    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,n+1):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] %mod
    return fac,finv
    # return(fac[n]*(finv[k]*finv[n-k]%mod)%mod)


cnt = 0
if n-1 >= K:
    fac1,finv1 = modconb(n,mod)
    for k in range(K+1):
        c1 = fac1[n]*(finv1[k]*finv1[n-k]%mod)%mod
        c2 = fac1[n-1]*(finv1[k]*finv1[n-1-k]%mod)%mod
        cnt += c1*c2
        cnt %= mod
    print(cnt%mod)
else:
    cnt1 = modcomb(2*(n-1),n-1,mod)
    cnt2 = modcomb(2*(n-1),n,mod)
    ans = (cnt1+cnt2)%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 def modcomb(n,a,mod):
    cnt = 1
    for i in range(a):
        cnt *= (n-i)
        cnt *= pow(i+1,mod-2,mod)
        cnt %= mod
    # print(cnt)
    return cnt modcomb cnt = 1 cnt 1 for i in range(a):
        cnt *= (n-i)
        cnt *= pow(i+1,mod-2,mod)
        cnt %= mod
    # print(cnt)
     i range(a) range a cnt *= (n-i) cnt n-i n i cnt *= pow(i+1,mod-2,mod) cnt pow(i+1,mod-2,mod) pow i+1 i 1 mod-2 mod 2 mod cnt %= mod cnt mod return cnt cnt n n a a mod mod def modconb(n,mod):
    # テーブルを作る
    fac = [0]*(n+1)
    finv = [0]*(n+1)
    inv = [0]*(n+1)  

    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,n+1):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] %mod
    return fac,finv
    # return(fac[n]*(finv[k]*finv[n-k]%mod)%mod) modconb fac = [0]*(n+1) fac [0]*(n+1) [0] 0 n+1 n 1 finv = [0]*(n+1) finv [0]*(n+1) [0] 0 n+1 n 1 inv = [0]*(n+1) inv [0]*(n+1) [0] 0 n+1 n 1 fac[0] = fac[1] = 1 fac[0] fac 0 1 = fac[1] = 1 fac[1] fac 1 1 finv[0] = finv[1] = 1 finv[0] finv 0 1 = finv[1] = 1 finv[1] finv 1 1 inv[1] = 1 inv[1] inv 1 1 for i in range(2,n+1):
        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+1) range 2 n+1 n 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 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 return fac,finv return fac,finv fac finv n n mod mod cnt = 0 cnt 0 if n-1 >= K:
    fac1,finv1 = modconb(n,mod)
    for k in range(K+1):
        c1 = fac1[n]*(finv1[k]*finv1[n-k]%mod)%mod
        c2 = fac1[n-1]*(finv1[k]*finv1[n-1-k]%mod)%mod
        cnt += c1*c2
        cnt %= mod
    print(cnt%mod)
else:
    cnt1 = modcomb(2*(n-1),n-1,mod)
    cnt2 = modcomb(2*(n-1),n,mod)
    ans = (cnt1+cnt2)%mod
    print(ans) n-1 >= K n-1 n 1 K fac1,finv1 = modconb(n,mod) fac1 modconb(n,mod) modconb n mod finv1 for k in range(K+1):
        c1 = fac1[n]*(finv1[k]*finv1[n-k]%mod)%mod
        c2 = fac1[n-1]*(finv1[k]*finv1[n-1-k]%mod)%mod
        cnt += c1*c2
        cnt %= mod
     k range(K+1) range K+1 K 1 c1 = fac1[n]*(finv1[k]*finv1[n-k]%mod)%mod c1 fac1[n]*(finv1[k]*finv1[n-k]%mod)%mod fac1[n]*(finv1[k]*finv1[n-k]%mod) fac1[n] fac1 n finv1[k]*finv1[n-k]%mod finv1[k]*finv1[n-k] finv1[k] finv1 k finv1[n-k] finv1 n-k n k mod mod c2 = fac1[n-1]*(finv1[k]*finv1[n-1-k]%mod)%mod c2 fac1[n-1]*(finv1[k]*finv1[n-1-k]%mod)%mod fac1[n-1]*(finv1[k]*finv1[n-1-k]%mod) fac1[n-1] fac1 n-1 n 1 finv1[k]*finv1[n-1-k]%mod finv1[k]*finv1[n-1-k] finv1[k] finv1 k finv1[n-1-k] finv1 n-1-k n-1 n 1 k mod mod cnt += c1*c2 cnt c1*c2 c1 c2 cnt %= mod cnt mod print(cnt%mod) print cnt%mod cnt mod cnt1 = modcomb(2*(n-1),n-1,mod) cnt1 modcomb(2*(n-1),n-1,mod) modcomb 2*(n-1) 2 n-1 n 1 n-1 n 1 mod cnt2 = modcomb(2*(n-1),n,mod) cnt2 modcomb(2*(n-1),n,mod) modcomb 2*(n-1) 2 n-1 n 1 n mod ans = (cnt1+cnt2)%mod ans (cnt1+cnt2)%mod cnt1+cnt2 cnt1 cnt2 mod print(ans) print ans K = map(int, input().split()) map(int, input().split()) K cnt1 = modcomb(2*(n-1),n-1,mod) modcomb(2*(n-1),n-1,mod) cnt1 cnt2 = modcomb(2*(n-1),n,mod) modcomb(2*(n-1),n,mod) cnt2 cnt = 0 0 cnt c2 = fac1[n-1]*(finv1[k]*finv1[n-1-k]%mod)%mod fac1[n-1]*(finv1[k]*finv1[n-1-k]%mod)%mod c2 cnt %= mod mod cnt c1 = fac1[n]*(finv1[k]*finv1[n-k]%mod)%mod fac1[n]*(finv1[k]*finv1[n-k]%mod)%mod c1 ans = (cnt1+cnt2)%mod (cnt1+cnt2)%mod ans def modcomb(n,a,mod):
    cnt = 1
    for i in range(a):
        cnt *= (n-i)
        cnt *= pow(i+1,mod-2,mod)
        cnt %= mod
    # print(cnt)
    return cnt def modcomb(n,a,mod):
    cnt = 1
    for i in range(a):
        cnt *= (n-i)
        cnt *= pow(i+1,mod-2,mod)
        cnt %= mod
    # print(cnt)
    return cnt modcomb def modconb(n,mod):
    # テーブルを作る
    fac = [0]*(n+1)
    finv = [0]*(n+1)
    inv = [0]*(n+1)  

    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,n+1):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] %mod
    return fac,finv
    # return(fac[n]*(finv[k]*finv[n-k]%mod)%mod) def modconb(n,mod):
    # テーブルを作る
    fac = [0]*(n+1)
    finv = [0]*(n+1)
    inv = [0]*(n+1)  

    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,n+1):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] %mod
    return fac,finv
    # return(fac[n]*(finv[k]*finv[n-k]%mod)%mod) modconb mod = 10**9 + 7 10**9 + 7 mod n,K = map(int, input().split()) map(int, input().split()) n fac1,finv1 = modconb(n,mod) modconb(n,mod) fac1 finv1 = modconb(n,mod) modconb(n,mod) finv1 cnt += c1*c2 c1*c2 cnt
n,K = map(int, input().split())
mod = 10**9 + 7

def modcomb(n,a,mod):
    cnt = 1
    for i in range(a):
        cnt *= (n-i)
        cnt *= pow(i+1,mod-2,mod)
        cnt %= mod
    # print(cnt)
    return cnt

def modconb(n,mod):
    # テーブルを作る
    fac = [0]*(n+1)
    finv = [0]*(n+1)
    inv = [0]*(n+1)  

    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,n+1):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] %mod
    return fac,finv
    # return(fac[n]*(finv[k]*finv[n-k]%mod)%mod)


cnt = 0
if n-1 >= K:
    fac1,finv1 = modconb(n,mod)
    for k in range(K+1):
        c1 = fac1[n]*(finv1[k]*finv1[n-k]%mod)%mod
        c2 = fac1[n-1]*(finv1[k]*finv1[n-1-k]%mod)%mod
        cnt += c1*c2
        cnt %= mod
    print(cnt%mod)
else:
    cnt1 = modcomb(2*(n-1),n-1,mod)
    cnt2 = modcomb(2*(n-1),n,mod)
    ans = (cnt1+cnt2)%mod
    print(ans)