def main():
    n,k = map(int, input().split())
    MOD = 10**9+7
    NMAX = 2*2*10**5

    fact = [0 for i in range(NMAX+5)]
    fact[0] = 1
    invfact = [0 for i in range(NMAX+5)]
    invfact[0] = 1

    for i in range(NMAX):
        fact[i+1] = (fact[i]*(i+1))%(MOD)

    invfact[NMAX] = pow(fact[NMAX], MOD-2, MOD)
    for i in range(NMAX-1,0,-1):
        invfact[i] = (invfact[i+1] * (i+1)) % MOD

    ans = 0
    if k >= n:
        k = n-1
    for i in range(k+1):
        z = fact[n]*invfact[i]%MOD
        z = z*invfact[n-i]%MOD
        h = fact[n-1]*invfact[i]%MOD
        h = h*invfact[n-i-1]%MOD
        ans += z*h%MOD

    print(ans%MOD)

main() def main():
    n,k = map(int, input().split())
    MOD = 10**9+7
    NMAX = 2*2*10**5

    fact = [0 for i in range(NMAX+5)]
    fact[0] = 1
    invfact = [0 for i in range(NMAX+5)]
    invfact[0] = 1

    for i in range(NMAX):
        fact[i+1] = (fact[i]*(i+1))%(MOD)

    invfact[NMAX] = pow(fact[NMAX], MOD-2, MOD)
    for i in range(NMAX-1,0,-1):
        invfact[i] = (invfact[i+1] * (i+1)) % MOD

    ans = 0
    if k >= n:
        k = n-1
    for i in range(k+1):
        z = fact[n]*invfact[i]%MOD
        z = z*invfact[n-i]%MOD
        h = fact[n-1]*invfact[i]%MOD
        h = h*invfact[n-i-1]%MOD
        ans += z*h%MOD

    print(ans%MOD) main 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 NMAX = 2*2*10**5 NMAX 2*2*10**5 2*2 2 2 10**5 10 5 0 for i in range(NMAX+5) for i in range(NMAX+5) i range(NMAX+5) range NMAX+5 NMAX 5 for i in range(NMAX+5) 0 fact = [0 for i in range(NMAX+5)] fact [0 for i in range(NMAX+5)] fact[0] = 1 fact[0] fact 0 1 0 for i in range(NMAX+5) for i in range(NMAX+5) i range(NMAX+5) range NMAX+5 NMAX 5 for i in range(NMAX+5) 0 invfact = [0 for i in range(NMAX+5)] invfact [0 for i in range(NMAX+5)] invfact[0] = 1 invfact[0] invfact 0 1 for i in range(NMAX):
        fact[i+1] = (fact[i]*(i+1))%(MOD)

     i range(NMAX) range NMAX 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 invfact[NMAX] = pow(fact[NMAX], MOD-2, MOD) invfact[NMAX] invfact NMAX pow(fact[NMAX], MOD-2, MOD) pow fact[NMAX] fact NMAX MOD-2 MOD 2 MOD for i in range(NMAX-1,0,-1):
        invfact[i] = (invfact[i+1] * (i+1)) % MOD

     i range(NMAX-1,0,-1) range NMAX-1 NMAX 1 0 -1 invfact[i] = (invfact[i+1] * (i+1)) % MOD invfact[i] invfact i (invfact[i+1] * (i+1)) % MOD invfact[i+1] * (i+1) invfact[i+1] invfact i+1 i 1 i+1 i 1 MOD ans = 0 ans 0 if k >= n:
        k = n-1
     k >= n k n k = n-1 k n-1 n 1 for i in range(k+1):
        z = fact[n]*invfact[i]%MOD
        z = z*invfact[n-i]%MOD
        h = fact[n-1]*invfact[i]%MOD
        h = h*invfact[n-i-1]%MOD
        ans += z*h%MOD

     i range(k+1) range k+1 k 1 z = fact[n]*invfact[i]%MOD z fact[n]*invfact[i]%MOD fact[n]*invfact[i] fact[n] fact n invfact[i] invfact i MOD z = z*invfact[n-i]%MOD z z*invfact[n-i]%MOD z*invfact[n-i] z invfact[n-i] invfact n-i n i MOD h = fact[n-1]*invfact[i]%MOD h fact[n-1]*invfact[i]%MOD fact[n-1]*invfact[i] fact[n-1] fact n-1 n 1 invfact[i] invfact i MOD h = h*invfact[n-i-1]%MOD h h*invfact[n-i-1]%MOD h*invfact[n-i-1] h invfact[n-i-1] invfact n-i-1 n-i n i 1 MOD ans += z*h%MOD ans z*h%MOD z*h z h MOD print(ans%MOD) print ans%MOD ans MOD main() main def main():
    n,k = map(int, input().split())
    MOD = 10**9+7
    NMAX = 2*2*10**5

    fact = [0 for i in range(NMAX+5)]
    fact[0] = 1
    invfact = [0 for i in range(NMAX+5)]
    invfact[0] = 1

    for i in range(NMAX):
        fact[i+1] = (fact[i]*(i+1))%(MOD)

    invfact[NMAX] = pow(fact[NMAX], MOD-2, MOD)
    for i in range(NMAX-1,0,-1):
        invfact[i] = (invfact[i+1] * (i+1)) % MOD

    ans = 0
    if k >= n:
        k = n-1
    for i in range(k+1):
        z = fact[n]*invfact[i]%MOD
        z = z*invfact[n-i]%MOD
        h = fact[n-1]*invfact[i]%MOD
        h = h*invfact[n-i-1]%MOD
        ans += z*h%MOD

    print(ans%MOD) def main():
    n,k = map(int, input().split())
    MOD = 10**9+7
    NMAX = 2*2*10**5

    fact = [0 for i in range(NMAX+5)]
    fact[0] = 1
    invfact = [0 for i in range(NMAX+5)]
    invfact[0] = 1

    for i in range(NMAX):
        fact[i+1] = (fact[i]*(i+1))%(MOD)

    invfact[NMAX] = pow(fact[NMAX], MOD-2, MOD)
    for i in range(NMAX-1,0,-1):
        invfact[i] = (invfact[i+1] * (i+1)) % MOD

    ans = 0
    if k >= n:
        k = n-1
    for i in range(k+1):
        z = fact[n]*invfact[i]%MOD
        z = z*invfact[n-i]%MOD
        h = fact[n-1]*invfact[i]%MOD
        h = h*invfact[n-i-1]%MOD
        ans += z*h%MOD

    print(ans%MOD) main
def main():
    n,k = map(int, input().split())
    MOD = 10**9+7
    NMAX = 2*2*10**5

    fact = [0 for i in range(NMAX+5)]
    fact[0] = 1
    invfact = [0 for i in range(NMAX+5)]
    invfact[0] = 1

    for i in range(NMAX):
        fact[i+1] = (fact[i]*(i+1))%(MOD)

    invfact[NMAX] = pow(fact[NMAX], MOD-2, MOD)
    for i in range(NMAX-1,0,-1):
        invfact[i] = (invfact[i+1] * (i+1)) % MOD

    ans = 0
    if k >= n:
        k = n-1
    for i in range(k+1):
        z = fact[n]*invfact[i]%MOD
        z = z*invfact[n-i]%MOD
        h = fact[n-1]*invfact[i]%MOD
        h = h*invfact[n-i-1]%MOD
        ans += z*h%MOD

    print(ans%MOD)

main()