#!/usr/bin/env python3

import sys


def read_int_list(sep=" "):
    return [int(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    return
    print(*args, **kwargs)


facto = None
ifacto = None

def precompute_facto(n, mod):
    global facto, ifacto
    facto = [1] * (n + 1)
    for i in range(1, n + 1):
        facto[i] = (facto[i - 1] * i) % mod
    ifacto = [1] * (n + 1)
    ifacto[n] = mod_inv(1, facto[n], mod)
    for i in range(0, n):
        p = n - i
        ifacto[p - 1] = ifacto[p] * p % mod


def mod_inv(a, b, mod):
    return (a * pow(b, mod - 2, mod)) % mod


def choose(a, b, mod):
    return facto[a] * ifacto[a - b] % mod * ifacto[b] % mod


def multi_choose(a, b, mod):
    return choose(a + b - 1, b, mod)


def main():
    mod = 1000000007
    n, k = read_int_list()
    precompute_facto(n, mod)
    ans = 0
    for i in range(0, min(k, n - 1) + 1):
        ans = (ans + choose(n, i, mod) * multi_choose(n - i, i, mod)) % mod
    print(ans)


if __name__ == "__main__":
    main() import sys sys def read_int_list(sep=" "):
    return [int(s) for s in sys.stdin.readline().rstrip().split(sep)] read_int_list int(s) for s in sys.stdin.readline().rstrip().split(sep) for s in sys.stdin.readline().rstrip().split(sep) s sys.stdin.readline().rstrip().split(sep) sys.stdin.readline().rstrip().split sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip split sep for s in sys.stdin.readline().rstrip().split(sep) int(s) int s return [int(s) for s in sys.stdin.readline().rstrip().split(sep)] [int(s) for s in sys.stdin.readline().rstrip().split(sep)] sep=" " sep " " def dprint(*args, **kwargs):
    return
    print(*args, **kwargs) dprint return print(*args, **kwargs) print *args args **kwargs kwargs *args **kwargs facto = None facto None ifacto = None ifacto None def precompute_facto(n, mod):
    global facto, ifacto
    facto = [1] * (n + 1)
    for i in range(1, n + 1):
        facto[i] = (facto[i - 1] * i) % mod
    ifacto = [1] * (n + 1)
    ifacto[n] = mod_inv(1, facto[n], mod)
    for i in range(0, n):
        p = n - i
        ifacto[p - 1] = ifacto[p] * p % mod precompute_facto global facto, ifacto facto = [1] * (n + 1) facto [1] * (n + 1) [1] 1 n + 1 n 1 for i in range(1, n + 1):
        facto[i] = (facto[i - 1] * i) % mod
     i range(1, n + 1) range 1 n + 1 n 1 facto[i] = (facto[i - 1] * i) % mod facto[i] facto i (facto[i - 1] * i) % mod facto[i - 1] * i facto[i - 1] facto i - 1 i 1 i mod ifacto = [1] * (n + 1) ifacto [1] * (n + 1) [1] 1 n + 1 n 1 ifacto[n] = mod_inv(1, facto[n], mod) ifacto[n] ifacto n mod_inv(1, facto[n], mod) mod_inv 1 facto[n] facto n mod for i in range(0, n):
        p = n - i
        ifacto[p - 1] = ifacto[p] * p % mod i range(0, n) range 0 n p = n - i p n - i n i ifacto[p - 1] = ifacto[p] * p % mod ifacto[p - 1] ifacto p - 1 p 1 ifacto[p] * p % mod ifacto[p] * p ifacto[p] ifacto p p mod n n mod mod def mod_inv(a, b, mod):
    return (a * pow(b, mod - 2, mod)) % mod mod_inv return (a * pow(b, mod - 2, mod)) % mod (a * pow(b, mod - 2, mod)) % mod a * pow(b, mod - 2, mod) a pow(b, mod - 2, mod) pow b mod - 2 mod 2 mod mod a a b b mod mod def choose(a, b, mod):
    return facto[a] * ifacto[a - b] % mod * ifacto[b] % mod choose return facto[a] * ifacto[a - b] % mod * ifacto[b] % mod facto[a] * ifacto[a - b] % mod * ifacto[b] % mod facto[a] * ifacto[a - b] % mod * ifacto[b] facto[a] * ifacto[a - b] % mod facto[a] * ifacto[a - b] facto[a] facto a ifacto[a - b] ifacto a - b a b mod ifacto[b] ifacto b mod a a b b mod mod def multi_choose(a, b, mod):
    return choose(a + b - 1, b, mod) multi_choose return choose(a + b - 1, b, mod) choose(a + b - 1, b, mod) choose a + b - 1 a + b a b 1 b mod a a b b mod mod def main():
    mod = 1000000007
    n, k = read_int_list()
    precompute_facto(n, mod)
    ans = 0
    for i in range(0, min(k, n - 1) + 1):
        ans = (ans + choose(n, i, mod) * multi_choose(n - i, i, mod)) % mod
    print(ans) main mod = 1000000007 mod 1000000007 n, k = read_int_list() n read_int_list() read_int_list k precompute_facto(n, mod) precompute_facto n mod ans = 0 ans 0 for i in range(0, min(k, n - 1) + 1):
        ans = (ans + choose(n, i, mod) * multi_choose(n - i, i, mod)) % mod
     i range(0, min(k, n - 1) + 1) range 0 min(k, n - 1) + 1 min(k, n - 1) min k n - 1 n 1 1 ans = (ans + choose(n, i, mod) * multi_choose(n - i, i, mod)) % mod ans (ans + choose(n, i, mod) * multi_choose(n - i, i, mod)) % mod ans + choose(n, i, mod) * multi_choose(n - i, i, mod) ans choose(n, i, mod) * multi_choose(n - i, i, mod) choose(n, i, mod) choose n i mod multi_choose(n - i, i, mod) multi_choose n - i n i i mod mod print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def choose(a, b, mod):
    return facto[a] * ifacto[a - b] % mod * ifacto[b] % mod def choose(a, b, mod):
    return facto[a] * ifacto[a - b] % mod * ifacto[b] % mod choose def mod_inv(a, b, mod):
    return (a * pow(b, mod - 2, mod)) % mod def mod_inv(a, b, mod):
    return (a * pow(b, mod - 2, mod)) % mod mod_inv def multi_choose(a, b, mod):
    return choose(a + b - 1, b, mod) def multi_choose(a, b, mod):
    return choose(a + b - 1, b, mod) multi_choose def read_int_list(sep=" "):
    return [int(s) for s in sys.stdin.readline().rstrip().split(sep)] def read_int_list(sep=" "):
    return [int(s) for s in sys.stdin.readline().rstrip().split(sep)] read_int_list def main():
    mod = 1000000007
    n, k = read_int_list()
    precompute_facto(n, mod)
    ans = 0
    for i in range(0, min(k, n - 1) + 1):
        ans = (ans + choose(n, i, mod) * multi_choose(n - i, i, mod)) % mod
    print(ans) def main():
    mod = 1000000007
    n, k = read_int_list()
    precompute_facto(n, mod)
    ans = 0
    for i in range(0, min(k, n - 1) + 1):
        ans = (ans + choose(n, i, mod) * multi_choose(n - i, i, mod)) % mod
    print(ans) main def precompute_facto(n, mod):
    global facto, ifacto
    facto = [1] * (n + 1)
    for i in range(1, n + 1):
        facto[i] = (facto[i - 1] * i) % mod
    ifacto = [1] * (n + 1)
    ifacto[n] = mod_inv(1, facto[n], mod)
    for i in range(0, n):
        p = n - i
        ifacto[p - 1] = ifacto[p] * p % mod def precompute_facto(n, mod):
    global facto, ifacto
    facto = [1] * (n + 1)
    for i in range(1, n + 1):
        facto[i] = (facto[i - 1] * i) % mod
    ifacto = [1] * (n + 1)
    ifacto[n] = mod_inv(1, facto[n], mod)
    for i in range(0, n):
        p = n - i
        ifacto[p - 1] = ifacto[p] * p % mod precompute_facto ifacto = None None ifacto def dprint(*args, **kwargs):
    return
    print(*args, **kwargs) def dprint(*args, **kwargs):
    return
    print(*args, **kwargs) dprint facto = None None facto
#!/usr/bin/env python3

import sys


def read_int_list(sep=" "):
    return [int(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    return
    print(*args, **kwargs)


facto = None
ifacto = None

def precompute_facto(n, mod):
    global facto, ifacto
    facto = [1] * (n + 1)
    for i in range(1, n + 1):
        facto[i] = (facto[i - 1] * i) % mod
    ifacto = [1] * (n + 1)
    ifacto[n] = mod_inv(1, facto[n], mod)
    for i in range(0, n):
        p = n - i
        ifacto[p - 1] = ifacto[p] * p % mod


def mod_inv(a, b, mod):
    return (a * pow(b, mod - 2, mod)) % mod


def choose(a, b, mod):
    return facto[a] * ifacto[a - b] % mod * ifacto[b] % mod


def multi_choose(a, b, mod):
    return choose(a + b - 1, b, mod)


def main():
    mod = 1000000007
    n, k = read_int_list()
    precompute_facto(n, mod)
    ans = 0
    for i in range(0, min(k, n - 1) + 1):
        ans = (ans + choose(n, i, mod) * multi_choose(n - i, i, mod)) % mod
    print(ans)


if __name__ == "__main__":
    main()
