mod = int(10 ** 9) + 7

def modinv(x, m = mod):
    b = m
    u = 1
    v = 0
    while b:
        t = x // b
        x -= t * b
        x, b = b, x
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u

def main():
    n, k = map(int, input().split())

    if k > n-1:
        k = n-1

    factorial = [None for _ in range(200001)]
    factorial[0] = 1
    factorial[1] = 1
    for i in range(2, 200001):
        factorial[i] = (factorial[i-1] * i) % mod

    posCount = [None for _ in range(n+1)]
    for i in range(n+1):
        posCount[i] = (factorial[n] * modinv((factorial[i] * factorial[n-i]) % mod)) % mod

    placeCount = [None for _ in range(n+1)]
    placeCount[0] = 0
    for i in range(1, n+1):
        placeCount[i] = (factorial[n-1] * modinv((factorial[i-1] * factorial[(n-1)-(i-1)]) % mod)) % mod

    ans = 0
    for i in range(-1, -k-2, -1):
        ans = (ans + (posCount[i] * placeCount[i])) % mod
    if k == 1:
        ans -= 1
        if ans < 0:
            ans += mod

    print(ans)

if __name__ == '__main__':
    main() mod = int(10 ** 9) + 7 mod int(10 ** 9) + 7 int(10 ** 9) int 10 ** 9 10 9 7 def modinv(x, m = mod):
    b = m
    u = 1
    v = 0
    while b:
        t = x // b
        x -= t * b
        x, b = b, x
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u modinv b = m b m u = 1 u 1 v = 0 v 0 while b:
        t = x // b
        x -= t * b
        x, b = b, x
        u -= t * v
        u, v = v, u
     b t = x // b t x // b x b x -= t * b x t * b t b x, b = b, x x b b x u -= t * v u t * v t v u, v = v, u u v v u u %= m u m if u < 0:
        u += m
     u < 0 u 0 u += m u m return u u x x m = mod m mod def main():
    n, k = map(int, input().split())

    if k > n-1:
        k = n-1

    factorial = [None for _ in range(200001)]
    factorial[0] = 1
    factorial[1] = 1
    for i in range(2, 200001):
        factorial[i] = (factorial[i-1] * i) % mod

    posCount = [None for _ in range(n+1)]
    for i in range(n+1):
        posCount[i] = (factorial[n] * modinv((factorial[i] * factorial[n-i]) % mod)) % mod

    placeCount = [None for _ in range(n+1)]
    placeCount[0] = 0
    for i in range(1, n+1):
        placeCount[i] = (factorial[n-1] * modinv((factorial[i-1] * factorial[(n-1)-(i-1)]) % mod)) % mod

    ans = 0
    for i in range(-1, -k-2, -1):
        ans = (ans + (posCount[i] * placeCount[i])) % mod
    if k == 1:
        ans -= 1
        if ans < 0:
            ans += mod

    print(ans) main n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k if k > n-1:
        k = n-1

     k > n-1 k n-1 n 1 k = n-1 k n-1 n 1 None for _ in range(200001) for _ in range(200001) _ range(200001) range 200001 for _ in range(200001) None factorial = [None for _ in range(200001)] factorial [None for _ in range(200001)] factorial[0] = 1 factorial[0] factorial 0 1 factorial[1] = 1 factorial[1] factorial 1 1 for i in range(2, 200001):
        factorial[i] = (factorial[i-1] * i) % mod

     i range(2, 200001) range 2 200001 factorial[i] = (factorial[i-1] * i) % mod factorial[i] factorial i (factorial[i-1] * i) % mod factorial[i-1] * i factorial[i-1] factorial i-1 i 1 i mod None for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) None posCount = [None for _ in range(n+1)] posCount [None for _ in range(n+1)] for i in range(n+1):
        posCount[i] = (factorial[n] * modinv((factorial[i] * factorial[n-i]) % mod)) % mod

     i range(n+1) range n+1 n 1 posCount[i] = (factorial[n] * modinv((factorial[i] * factorial[n-i]) % mod)) % mod posCount[i] posCount i (factorial[n] * modinv((factorial[i] * factorial[n-i]) % mod)) % mod factorial[n] * modinv((factorial[i] * factorial[n-i]) % mod) factorial[n] factorial n modinv((factorial[i] * factorial[n-i]) % mod) modinv (factorial[i] * factorial[n-i]) % mod factorial[i] * factorial[n-i] factorial[i] factorial i factorial[n-i] factorial n-i n i mod mod None for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) None placeCount = [None for _ in range(n+1)] placeCount [None for _ in range(n+1)] placeCount[0] = 0 placeCount[0] placeCount 0 0 for i in range(1, n+1):
        placeCount[i] = (factorial[n-1] * modinv((factorial[i-1] * factorial[(n-1)-(i-1)]) % mod)) % mod

     i range(1, n+1) range 1 n+1 n 1 placeCount[i] = (factorial[n-1] * modinv((factorial[i-1] * factorial[(n-1)-(i-1)]) % mod)) % mod placeCount[i] placeCount i (factorial[n-1] * modinv((factorial[i-1] * factorial[(n-1)-(i-1)]) % mod)) % mod factorial[n-1] * modinv((factorial[i-1] * factorial[(n-1)-(i-1)]) % mod) factorial[n-1] factorial n-1 n 1 modinv((factorial[i-1] * factorial[(n-1)-(i-1)]) % mod) modinv (factorial[i-1] * factorial[(n-1)-(i-1)]) % mod factorial[i-1] * factorial[(n-1)-(i-1)] factorial[i-1] factorial i-1 i 1 factorial[(n-1)-(i-1)] factorial (n-1)-(i-1) n-1 n 1 i-1 i 1 mod mod ans = 0 ans 0 for i in range(-1, -k-2, -1):
        ans = (ans + (posCount[i] * placeCount[i])) % mod
     i range(-1, -k-2, -1) range -1 -k-2 -k k 2 -1 ans = (ans + (posCount[i] * placeCount[i])) % mod ans (ans + (posCount[i] * placeCount[i])) % mod ans + (posCount[i] * placeCount[i]) ans posCount[i] * placeCount[i] posCount[i] posCount i placeCount[i] placeCount i mod if k == 1:
        ans -= 1
        if ans < 0:
            ans += mod

     k == 1 k 1 ans -= 1 ans 1 if ans < 0:
            ans += mod

     ans < 0 ans 0 ans += mod ans mod print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def modinv(x, m = mod):
    b = m
    u = 1
    v = 0
    while b:
        t = x // b
        x -= t * b
        x, b = b, x
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u def modinv(x, m = mod):
    b = m
    u = 1
    v = 0
    while b:
        t = x // b
        x -= t * b
        x, b = b, x
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u modinv mod = int(10 ** 9) + 7 int(10 ** 9) + 7 mod def main():
    n, k = map(int, input().split())

    if k > n-1:
        k = n-1

    factorial = [None for _ in range(200001)]
    factorial[0] = 1
    factorial[1] = 1
    for i in range(2, 200001):
        factorial[i] = (factorial[i-1] * i) % mod

    posCount = [None for _ in range(n+1)]
    for i in range(n+1):
        posCount[i] = (factorial[n] * modinv((factorial[i] * factorial[n-i]) % mod)) % mod

    placeCount = [None for _ in range(n+1)]
    placeCount[0] = 0
    for i in range(1, n+1):
        placeCount[i] = (factorial[n-1] * modinv((factorial[i-1] * factorial[(n-1)-(i-1)]) % mod)) % mod

    ans = 0
    for i in range(-1, -k-2, -1):
        ans = (ans + (posCount[i] * placeCount[i])) % mod
    if k == 1:
        ans -= 1
        if ans < 0:
            ans += mod

    print(ans) def main():
    n, k = map(int, input().split())

    if k > n-1:
        k = n-1

    factorial = [None for _ in range(200001)]
    factorial[0] = 1
    factorial[1] = 1
    for i in range(2, 200001):
        factorial[i] = (factorial[i-1] * i) % mod

    posCount = [None for _ in range(n+1)]
    for i in range(n+1):
        posCount[i] = (factorial[n] * modinv((factorial[i] * factorial[n-i]) % mod)) % mod

    placeCount = [None for _ in range(n+1)]
    placeCount[0] = 0
    for i in range(1, n+1):
        placeCount[i] = (factorial[n-1] * modinv((factorial[i-1] * factorial[(n-1)-(i-1)]) % mod)) % mod

    ans = 0
    for i in range(-1, -k-2, -1):
        ans = (ans + (posCount[i] * placeCount[i])) % mod
    if k == 1:
        ans -= 1
        if ans < 0:
            ans += mod

    print(ans) main
mod = int(10 ** 9) + 7

def modinv(x, m = mod):
    b = m
    u = 1
    v = 0
    while b:
        t = x // b
        x -= t * b
        x, b = b, x
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u

def main():
    n, k = map(int, input().split())

    if k > n-1:
        k = n-1

    factorial = [None for _ in range(200001)]
    factorial[0] = 1
    factorial[1] = 1
    for i in range(2, 200001):
        factorial[i] = (factorial[i-1] * i) % mod

    posCount = [None for _ in range(n+1)]
    for i in range(n+1):
        posCount[i] = (factorial[n] * modinv((factorial[i] * factorial[n-i]) % mod)) % mod

    placeCount = [None for _ in range(n+1)]
    placeCount[0] = 0
    for i in range(1, n+1):
        placeCount[i] = (factorial[n-1] * modinv((factorial[i-1] * factorial[(n-1)-(i-1)]) % mod)) % mod

    ans = 0
    for i in range(-1, -k-2, -1):
        ans = (ans + (posCount[i] * placeCount[i])) % mod
    if k == 1:
        ans -= 1
        if ans < 0:
            ans += mod

    print(ans)

if __name__ == '__main__':
    main()
