if __name__ == "__main__":
    n, k = map(int, input().split())
    p = 10**9 + 7

    answer = 0
    nCi = 1
    n_1Ci = 1
    for i in range(min(k + 1, n)):
        answer += nCi * n_1Ci
        answer %= p
        deno = pow(i + 1, p - 2, p)
        nCi *= (n - i) * deno
        nCi %= p
        n_1Ci *= (n - i - 1) * deno
        n_1Ci %= p

    print(answer) if __name__ == "__main__":
    n, k = map(int, input().split())
    p = 10**9 + 7

    answer = 0
    nCi = 1
    n_1Ci = 1
    for i in range(min(k + 1, n)):
        answer += nCi * n_1Ci
        answer %= p
        deno = pow(i + 1, p - 2, p)
        nCi *= (n - i) * deno
        nCi %= p
        n_1Ci *= (n - i - 1) * deno
        n_1Ci %= p

    print(answer) __name__ == "__main__" __name__ "__main__" n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k p = 10**9 + 7 p 10**9 + 7 10**9 10 9 7 answer = 0 answer 0 nCi = 1 nCi 1 n_1Ci = 1 n_1Ci 1 for i in range(min(k + 1, n)):
        answer += nCi * n_1Ci
        answer %= p
        deno = pow(i + 1, p - 2, p)
        nCi *= (n - i) * deno
        nCi %= p
        n_1Ci *= (n - i - 1) * deno
        n_1Ci %= p

     i range(min(k + 1, n)) range min(k + 1, n) min k + 1 k 1 n answer += nCi * n_1Ci answer nCi * n_1Ci nCi n_1Ci answer %= p answer p deno = pow(i + 1, p - 2, p) deno pow(i + 1, p - 2, p) pow i + 1 i 1 p - 2 p 2 p nCi *= (n - i) * deno nCi (n - i) * deno n - i n i deno nCi %= p nCi p n_1Ci *= (n - i - 1) * deno n_1Ci (n - i - 1) * deno n - i - 1 n - i n i 1 deno n_1Ci %= p n_1Ci p print(answer) print answer deno = pow(i + 1, p - 2, p) pow(i + 1, p - 2, p) deno n_1Ci = 1 1 n_1Ci answer += nCi * n_1Ci nCi * n_1Ci answer p = 10**9 + 7 10**9 + 7 p answer = 0 0 answer n_1Ci %= p p n_1Ci n_1Ci *= (n - i - 1) * deno (n - i - 1) * deno n_1Ci n, k = map(int, input().split()) map(int, input().split()) n k = map(int, input().split()) map(int, input().split()) k answer %= p p answer nCi *= (n - i) * deno (n - i) * deno nCi nCi %= p p nCi nCi = 1 1 nCi
if __name__ == "__main__":
    n, k = map(int, input().split())
    p = 10**9 + 7

    answer = 0
    nCi = 1
    n_1Ci = 1
    for i in range(min(k + 1, n)):
        answer += nCi * n_1Ci
        answer %= p
        deno = pow(i + 1, p - 2, p)
        nCi *= (n - i) * deno
        nCi %= p
        n_1Ci *= (n - i - 1) * deno
        n_1Ci %= p

    print(answer)
