# from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
from functools import reduce

# a, b = [int(v) for v in input().split()]


def main():

    mod = 1000000007
    n, k = map(int, input().split())

    fact1 = [0] * (n + 1)  # 1/P!
    fact1[0] = 1

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

    fact2 = [0] * (n + 1)  # P!
    fact2[n] = pow(fact1[n], mod-2, mod)

    for i in range(n, 0, -1):
        fact2[i - 1] = (fact2[i] * i) % mod

    def cmb2(n, r, mod):
        if r < 0 or r > n:
            return 0
        return fact1[n] * fact2[n - r] * fact2[r] % mod

    ans = 0
    for i in range(min(n - 1, k) + 1):
        ans += cmb2(n, i, mod) * cmb2(n - 1, i, mod)
        ans %= mod
    print(ans)


main() from functools import reduce def main():

    mod = 1000000007
    n, k = map(int, input().split())

    fact1 = [0] * (n + 1)  # 1/P!
    fact1[0] = 1

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

    fact2 = [0] * (n + 1)  # P!
    fact2[n] = pow(fact1[n], mod-2, mod)

    for i in range(n, 0, -1):
        fact2[i - 1] = (fact2[i] * i) % mod

    def cmb2(n, r, mod):
        if r < 0 or r > n:
            return 0
        return fact1[n] * fact2[n - r] * fact2[r] % mod

    ans = 0
    for i in range(min(n - 1, k) + 1):
        ans += cmb2(n, i, mod) * cmb2(n - 1, i, mod)
        ans %= mod
    print(ans) main mod = 1000000007 mod 1000000007 n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k fact1 = [0] * (n + 1) fact1 [0] * (n + 1) [0] 0 n + 1 n 1 fact1[0] = 1 fact1[0] fact1 0 1 for i in range(1, n + 1):
        fact1[i] = (fact1[i - 1] * i) % mod

     i range(1, n + 1) range 1 n + 1 n 1 fact1[i] = (fact1[i - 1] * i) % mod fact1[i] fact1 i (fact1[i - 1] * i) % mod fact1[i - 1] * i fact1[i - 1] fact1 i - 1 i 1 i mod fact2 = [0] * (n + 1) fact2 [0] * (n + 1) [0] 0 n + 1 n 1 fact2[n] = pow(fact1[n], mod-2, mod) fact2[n] fact2 n pow(fact1[n], mod-2, mod) pow fact1[n] fact1 n mod-2 mod 2 mod for i in range(n, 0, -1):
        fact2[i - 1] = (fact2[i] * i) % mod

     i range(n, 0, -1) range n 0 -1 fact2[i - 1] = (fact2[i] * i) % mod fact2[i - 1] fact2 i - 1 i 1 (fact2[i] * i) % mod fact2[i] * i fact2[i] fact2 i i mod def cmb2(n, r, mod):
        if r < 0 or r > n:
            return 0
        return fact1[n] * fact2[n - r] * fact2[r] % mod

     cmb2 if r < 0 or r > n:
            return 0
         r < 0 or r > n r < 0 r 0 r > n r n return 0 0 return fact1[n] * fact2[n - r] * fact2[r] % mod fact1[n] * fact2[n - r] * fact2[r] % mod fact1[n] * fact2[n - r] * fact2[r] fact1[n] * fact2[n - r] fact1[n] fact1 n fact2[n - r] fact2 n - r n r fact2[r] fact2 r mod n n r r mod mod ans = 0 ans 0 for i in range(min(n - 1, k) + 1):
        ans += cmb2(n, i, mod) * cmb2(n - 1, i, mod)
        ans %= mod
     i range(min(n - 1, k) + 1) range min(n - 1, k) + 1 min(n - 1, k) min n - 1 n 1 k 1 ans += cmb2(n, i, mod) * cmb2(n - 1, i, mod) ans cmb2(n, i, mod) * cmb2(n - 1, i, mod) cmb2(n, i, mod) cmb2 n i mod cmb2(n - 1, i, mod) cmb2 n - 1 n 1 i mod ans %= mod ans mod print(ans) print ans main() main def main():

    mod = 1000000007
    n, k = map(int, input().split())

    fact1 = [0] * (n + 1)  # 1/P!
    fact1[0] = 1

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

    fact2 = [0] * (n + 1)  # P!
    fact2[n] = pow(fact1[n], mod-2, mod)

    for i in range(n, 0, -1):
        fact2[i - 1] = (fact2[i] * i) % mod

    def cmb2(n, r, mod):
        if r < 0 or r > n:
            return 0
        return fact1[n] * fact2[n - r] * fact2[r] % mod

    ans = 0
    for i in range(min(n - 1, k) + 1):
        ans += cmb2(n, i, mod) * cmb2(n - 1, i, mod)
        ans %= mod
    print(ans) def main():

    mod = 1000000007
    n, k = map(int, input().split())

    fact1 = [0] * (n + 1)  # 1/P!
    fact1[0] = 1

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

    fact2 = [0] * (n + 1)  # P!
    fact2[n] = pow(fact1[n], mod-2, mod)

    for i in range(n, 0, -1):
        fact2[i - 1] = (fact2[i] * i) % mod

    def cmb2(n, r, mod):
        if r < 0 or r > n:
            return 0
        return fact1[n] * fact2[n - r] * fact2[r] % mod

    ans = 0
    for i in range(min(n - 1, k) + 1):
        ans += cmb2(n, i, mod) * cmb2(n - 1, i, mod)
        ans %= mod
    print(ans) main
# from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
from functools import reduce

# a, b = [int(v) for v in input().split()]


def main():

    mod = 1000000007
    n, k = map(int, input().split())

    fact1 = [0] * (n + 1)  # 1/P!
    fact1[0] = 1

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

    fact2 = [0] * (n + 1)  # P!
    fact2[n] = pow(fact1[n], mod-2, mod)

    for i in range(n, 0, -1):
        fact2[i - 1] = (fact2[i] * i) % mod

    def cmb2(n, r, mod):
        if r < 0 or r > n:
            return 0
        return fact1[n] * fact2[n - r] * fact2[r] % mod

    ans = 0
    for i in range(min(n - 1, k) + 1):
        ans += cmb2(n, i, mod) * cmb2(n - 1, i, mod)
        ans %= mod
    print(ans)


main()
