def pow_mod(a, b, p):
    res = 1
    mul = a
    for i in range(len(bin(b)) - 2):
        if (1 << i) & b:
            res = (res * mul) % p
        mul = (mul ** 2) % p
    return res


def comb_mod(n, r, p, factorial, invert_factorial):
    return (factorial[n] * invert_factorial[r] * invert_factorial[n - r]) % p


def main():
    p = 10 ** 9 + 7
    n, k = map(int, input().split())

    factorial = [1] * (n + 1)
    for i in range(1, n + 1):
        factorial[i] = (factorial[i - 1] * i) % p

    invert_factorial = [0] * (n + 1)
    invert_factorial[n] = pow_mod(factorial[n], p - 2, p)
    for i in range(n - 1, -1, -1):
        invert_factorial[i] = (invert_factorial[i + 1] * (i + 1)) % p

    res = 0
    for i in range(min(k + 1, n)):
        res = (res + comb_mod(n, i, p, factorial, invert_factorial)
               * comb_mod(n - 1, i, p, factorial, invert_factorial)) % p
    print(res)


main() def pow_mod(a, b, p):
    res = 1
    mul = a
    for i in range(len(bin(b)) - 2):
        if (1 << i) & b:
            res = (res * mul) % p
        mul = (mul ** 2) % p
    return res pow_mod res = 1 res 1 mul = a mul a for i in range(len(bin(b)) - 2):
        if (1 << i) & b:
            res = (res * mul) % p
        mul = (mul ** 2) % p
     i range(len(bin(b)) - 2) range len(bin(b)) - 2 len(bin(b)) len bin(b) bin b 2 if (1 << i) & b:
            res = (res * mul) % p
         (1 << i) & b 1 << i 1 i b res = (res * mul) % p res (res * mul) % p res * mul res mul p mul = (mul ** 2) % p mul (mul ** 2) % p mul ** 2 mul 2 p return res res a a b b p p def comb_mod(n, r, p, factorial, invert_factorial):
    return (factorial[n] * invert_factorial[r] * invert_factorial[n - r]) % p comb_mod return (factorial[n] * invert_factorial[r] * invert_factorial[n - r]) % p (factorial[n] * invert_factorial[r] * invert_factorial[n - r]) % p factorial[n] * invert_factorial[r] * invert_factorial[n - r] factorial[n] * invert_factorial[r] factorial[n] factorial n invert_factorial[r] invert_factorial r invert_factorial[n - r] invert_factorial n - r n r p n n r r p p factorial factorial invert_factorial invert_factorial def main():
    p = 10 ** 9 + 7
    n, k = map(int, input().split())

    factorial = [1] * (n + 1)
    for i in range(1, n + 1):
        factorial[i] = (factorial[i - 1] * i) % p

    invert_factorial = [0] * (n + 1)
    invert_factorial[n] = pow_mod(factorial[n], p - 2, p)
    for i in range(n - 1, -1, -1):
        invert_factorial[i] = (invert_factorial[i + 1] * (i + 1)) % p

    res = 0
    for i in range(min(k + 1, n)):
        res = (res + comb_mod(n, i, p, factorial, invert_factorial)
               * comb_mod(n - 1, i, p, factorial, invert_factorial)) % p
    print(res) main p = 10 ** 9 + 7 p 10 ** 9 + 7 10 ** 9 10 9 7 n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k factorial = [1] * (n + 1) factorial [1] * (n + 1) [1] 1 n + 1 n 1 for i in range(1, n + 1):
        factorial[i] = (factorial[i - 1] * i) % p

     i range(1, n + 1) range 1 n + 1 n 1 factorial[i] = (factorial[i - 1] * i) % p factorial[i] factorial i (factorial[i - 1] * i) % p factorial[i - 1] * i factorial[i - 1] factorial i - 1 i 1 i p invert_factorial = [0] * (n + 1) invert_factorial [0] * (n + 1) [0] 0 n + 1 n 1 invert_factorial[n] = pow_mod(factorial[n], p - 2, p) invert_factorial[n] invert_factorial n pow_mod(factorial[n], p - 2, p) pow_mod factorial[n] factorial n p - 2 p 2 p for i in range(n - 1, -1, -1):
        invert_factorial[i] = (invert_factorial[i + 1] * (i + 1)) % p

     i range(n - 1, -1, -1) range n - 1 n 1 -1 -1 invert_factorial[i] = (invert_factorial[i + 1] * (i + 1)) % p invert_factorial[i] invert_factorial i (invert_factorial[i + 1] * (i + 1)) % p invert_factorial[i + 1] * (i + 1) invert_factorial[i + 1] invert_factorial i + 1 i 1 i + 1 i 1 p res = 0 res 0 for i in range(min(k + 1, n)):
        res = (res + comb_mod(n, i, p, factorial, invert_factorial)
               * comb_mod(n - 1, i, p, factorial, invert_factorial)) % p
     i range(min(k + 1, n)) range min(k + 1, n) min k + 1 k 1 n res = (res + comb_mod(n, i, p, factorial, invert_factorial)
               * comb_mod(n - 1, i, p, factorial, invert_factorial)) % p res (res + comb_mod(n, i, p, factorial, invert_factorial)
               * comb_mod(n - 1, i, p, factorial, invert_factorial)) % p res + comb_mod(n, i, p, factorial, invert_factorial)
               * comb_mod(n - 1, i, p, factorial, invert_factorial) res comb_mod(n, i, p, factorial, invert_factorial)
               * comb_mod(n - 1, i, p, factorial, invert_factorial) comb_mod(n, i, p, factorial, invert_factorial) comb_mod n i p factorial invert_factorial comb_mod(n - 1, i, p, factorial, invert_factorial) comb_mod n - 1 n 1 i p factorial invert_factorial p print(res) print res main() main def pow_mod(a, b, p):
    res = 1
    mul = a
    for i in range(len(bin(b)) - 2):
        if (1 << i) & b:
            res = (res * mul) % p
        mul = (mul ** 2) % p
    return res def pow_mod(a, b, p):
    res = 1
    mul = a
    for i in range(len(bin(b)) - 2):
        if (1 << i) & b:
            res = (res * mul) % p
        mul = (mul ** 2) % p
    return res pow_mod def comb_mod(n, r, p, factorial, invert_factorial):
    return (factorial[n] * invert_factorial[r] * invert_factorial[n - r]) % p def comb_mod(n, r, p, factorial, invert_factorial):
    return (factorial[n] * invert_factorial[r] * invert_factorial[n - r]) % p comb_mod def main():
    p = 10 ** 9 + 7
    n, k = map(int, input().split())

    factorial = [1] * (n + 1)
    for i in range(1, n + 1):
        factorial[i] = (factorial[i - 1] * i) % p

    invert_factorial = [0] * (n + 1)
    invert_factorial[n] = pow_mod(factorial[n], p - 2, p)
    for i in range(n - 1, -1, -1):
        invert_factorial[i] = (invert_factorial[i + 1] * (i + 1)) % p

    res = 0
    for i in range(min(k + 1, n)):
        res = (res + comb_mod(n, i, p, factorial, invert_factorial)
               * comb_mod(n - 1, i, p, factorial, invert_factorial)) % p
    print(res) def main():
    p = 10 ** 9 + 7
    n, k = map(int, input().split())

    factorial = [1] * (n + 1)
    for i in range(1, n + 1):
        factorial[i] = (factorial[i - 1] * i) % p

    invert_factorial = [0] * (n + 1)
    invert_factorial[n] = pow_mod(factorial[n], p - 2, p)
    for i in range(n - 1, -1, -1):
        invert_factorial[i] = (invert_factorial[i + 1] * (i + 1)) % p

    res = 0
    for i in range(min(k + 1, n)):
        res = (res + comb_mod(n, i, p, factorial, invert_factorial)
               * comb_mod(n - 1, i, p, factorial, invert_factorial)) % p
    print(res) main
def pow_mod(a, b, p):
    res = 1
    mul = a
    for i in range(len(bin(b)) - 2):
        if (1 << i) & b:
            res = (res * mul) % p
        mul = (mul ** 2) % p
    return res


def comb_mod(n, r, p, factorial, invert_factorial):
    return (factorial[n] * invert_factorial[r] * invert_factorial[n - r]) % p


def main():
    p = 10 ** 9 + 7
    n, k = map(int, input().split())

    factorial = [1] * (n + 1)
    for i in range(1, n + 1):
        factorial[i] = (factorial[i - 1] * i) % p

    invert_factorial = [0] * (n + 1)
    invert_factorial[n] = pow_mod(factorial[n], p - 2, p)
    for i in range(n - 1, -1, -1):
        invert_factorial[i] = (invert_factorial[i + 1] * (i + 1)) % p

    res = 0
    for i in range(min(k + 1, n)):
        res = (res + comb_mod(n, i, p, factorial, invert_factorial)
               * comb_mod(n - 1, i, p, factorial, invert_factorial)) % p
    print(res)


main()
