# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.readline
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import combinations
def run():
    n,k = map(int, input().split())
    mod = 10 ** 9 + 7
    ret = 0
    inv = generate_inv(n, mod)

    if k >= n-1:
        k = n-1
    left = 1
    right = 1
    ret = 1
    for h in range(1, k+1):
        right *= (n - h) * inv[h]
        right %= mod
        left *= (n - h + 1) * inv[h]
        left %= mod
        ret += right * left
        ret %= mod
    print(ret)


def generate_inv(n,mod):
    """
    逆元行列
    n >= 2
    """
    ret = [0, 1]
    for i in range(2,n+1):
        next = -ret[mod%i] * (mod // i)
        next %= mod
        ret.append(next)
    return ret


def comb_mod(n, a, mod):
    """
    return: [n, a] % mod
    Note: mod must be a prime number
    """
    up = 1
    down = 1
    for i in range(a):
        up *= n - i
        up %= mod
        down *= i + 1
        down %= mod
    down = pow_mod(down, mod - 2, mod)
    return (up * down) % mod

def pow_mod(n, k, mod):
    res = 1
    while True:
        if k // 2 >= 1:
            if k % 2 == 1:
                res = (res * n) % mod
            n = (n ** 2) % mod
            k = k // 2
        else:
            break
    return (n * res) % mod


if __name__ == "__main__":
    run() import sys sys sysread = sys.stdin.readline sysread sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 import math math def run():
    n,k = map(int, input().split())
    mod = 10 ** 9 + 7
    ret = 0
    inv = generate_inv(n, mod)

    if k >= n-1:
        k = n-1
    left = 1
    right = 1
    ret = 1
    for h in range(1, k+1):
        right *= (n - h) * inv[h]
        right %= mod
        left *= (n - h + 1) * inv[h]
        left %= mod
        ret += right * left
        ret %= mod
    print(ret) run n,k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 ret = 0 ret 0 inv = generate_inv(n, mod) inv generate_inv(n, mod) generate_inv n mod if k >= n-1:
        k = n-1
     k >= n-1 k n-1 n 1 k = n-1 k n-1 n 1 left = 1 left 1 right = 1 right 1 ret = 1 ret 1 for h in range(1, k+1):
        right *= (n - h) * inv[h]
        right %= mod
        left *= (n - h + 1) * inv[h]
        left %= mod
        ret += right * left
        ret %= mod
     h range(1, k+1) range 1 k+1 k 1 right *= (n - h) * inv[h] right (n - h) * inv[h] n - h n h inv[h] inv h right %= mod right mod left *= (n - h + 1) * inv[h] left (n - h + 1) * inv[h] n - h + 1 n - h n h 1 inv[h] inv h left %= mod left mod ret += right * left ret right * left right left ret %= mod ret mod print(ret) print ret def generate_inv(n,mod):
    """
    逆元行列
    n >= 2
    """
    ret = [0, 1]
    for i in range(2,n+1):
        next = -ret[mod%i] * (mod // i)
        next %= mod
        ret.append(next)
    return ret generate_inv """
    逆元行列
    n >= 2
    """ ret = [0, 1] ret [0, 1] 0 1 for i in range(2,n+1):
        next = -ret[mod%i] * (mod // i)
        next %= mod
        ret.append(next)
     i range(2,n+1) range 2 n+1 n 1 next = -ret[mod%i] * (mod // i) next -ret[mod%i] * (mod // i) -ret[mod%i] ret[mod%i] ret mod%i mod i mod // i mod i next %= mod next mod ret.append(next) ret.append ret append next return ret ret n n mod mod def comb_mod(n, a, mod):
    """
    return: [n, a] % mod
    Note: mod must be a prime number
    """
    up = 1
    down = 1
    for i in range(a):
        up *= n - i
        up %= mod
        down *= i + 1
        down %= mod
    down = pow_mod(down, mod - 2, mod)
    return (up * down) % mod comb_mod """
    return: [n, a] % mod
    Note: mod must be a prime number
    """ up = 1 up 1 down = 1 down 1 for i in range(a):
        up *= n - i
        up %= mod
        down *= i + 1
        down %= mod
     i range(a) range a up *= n - i up n - i n i up %= mod up mod down *= i + 1 down i + 1 i 1 down %= mod down mod down = pow_mod(down, mod - 2, mod) down pow_mod(down, mod - 2, mod) pow_mod down mod - 2 mod 2 mod return (up * down) % mod (up * down) % mod up * down up down mod n n a a mod mod def pow_mod(n, k, mod):
    res = 1
    while True:
        if k // 2 >= 1:
            if k % 2 == 1:
                res = (res * n) % mod
            n = (n ** 2) % mod
            k = k // 2
        else:
            break
    return (n * res) % mod pow_mod res = 1 res 1 while True:
        if k // 2 >= 1:
            if k % 2 == 1:
                res = (res * n) % mod
            n = (n ** 2) % mod
            k = k // 2
        else:
            break
     True if k // 2 >= 1:
            if k % 2 == 1:
                res = (res * n) % mod
            n = (n ** 2) % mod
            k = k // 2
        else:
            break
     k // 2 >= 1 k // 2 k 2 1 if k % 2 == 1:
                res = (res * n) % mod
             k % 2 == 1 k % 2 k 2 1 res = (res * n) % mod res (res * n) % mod res * n res n mod n = (n ** 2) % mod n (n ** 2) % mod n ** 2 n 2 mod k = k // 2 k k // 2 k 2 break return (n * res) % mod (n * res) % mod n * res n res mod n n k k mod mod if __name__ == "__main__":
    run() __name__ == "__main__" __name__ "__main__" run() run def run():
    n,k = map(int, input().split())
    mod = 10 ** 9 + 7
    ret = 0
    inv = generate_inv(n, mod)

    if k >= n-1:
        k = n-1
    left = 1
    right = 1
    ret = 1
    for h in range(1, k+1):
        right *= (n - h) * inv[h]
        right %= mod
        left *= (n - h + 1) * inv[h]
        left %= mod
        ret += right * left
        ret %= mod
    print(ret) def run():
    n,k = map(int, input().split())
    mod = 10 ** 9 + 7
    ret = 0
    inv = generate_inv(n, mod)

    if k >= n-1:
        k = n-1
    left = 1
    right = 1
    ret = 1
    for h in range(1, k+1):
        right *= (n - h) * inv[h]
        right %= mod
        left *= (n - h + 1) * inv[h]
        left %= mod
        ret += right * left
        ret %= mod
    print(ret) run def generate_inv(n,mod):
    """
    逆元行列
    n >= 2
    """
    ret = [0, 1]
    for i in range(2,n+1):
        next = -ret[mod%i] * (mod // i)
        next %= mod
        ret.append(next)
    return ret def generate_inv(n,mod):
    """
    逆元行列
    n >= 2
    """
    ret = [0, 1]
    for i in range(2,n+1):
        next = -ret[mod%i] * (mod // i)
        next %= mod
        ret.append(next)
    return ret generate_inv def comb_mod(n, a, mod):
    """
    return: [n, a] % mod
    Note: mod must be a prime number
    """
    up = 1
    down = 1
    for i in range(a):
        up *= n - i
        up %= mod
        down *= i + 1
        down %= mod
    down = pow_mod(down, mod - 2, mod)
    return (up * down) % mod def comb_mod(n, a, mod):
    """
    return: [n, a] % mod
    Note: mod must be a prime number
    """
    up = 1
    down = 1
    for i in range(a):
        up *= n - i
        up %= mod
        down *= i + 1
        down %= mod
    down = pow_mod(down, mod - 2, mod)
    return (up * down) % mod comb_mod sysread = sys.stdin.readline sys.stdin.readline sysread def pow_mod(n, k, mod):
    res = 1
    while True:
        if k // 2 >= 1:
            if k % 2 == 1:
                res = (res * n) % mod
            n = (n ** 2) % mod
            k = k // 2
        else:
            break
    return (n * res) % mod def pow_mod(n, k, mod):
    res = 1
    while True:
        if k // 2 >= 1:
            if k % 2 == 1:
                res = (res * n) % mod
            n = (n ** 2) % mod
            k = k // 2
        else:
            break
    return (n * res) % mod pow_mod
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.readline
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import combinations
def run():
    n,k = map(int, input().split())
    mod = 10 ** 9 + 7
    ret = 0
    inv = generate_inv(n, mod)

    if k >= n-1:
        k = n-1
    left = 1
    right = 1
    ret = 1
    for h in range(1, k+1):
        right *= (n - h) * inv[h]
        right %= mod
        left *= (n - h + 1) * inv[h]
        left %= mod
        ret += right * left
        ret %= mod
    print(ret)


def generate_inv(n,mod):
    """
    逆元行列
    n >= 2
    """
    ret = [0, 1]
    for i in range(2,n+1):
        next = -ret[mod%i] * (mod // i)
        next %= mod
        ret.append(next)
    return ret


def comb_mod(n, a, mod):
    """
    return: [n, a] % mod
    Note: mod must be a prime number
    """
    up = 1
    down = 1
    for i in range(a):
        up *= n - i
        up %= mod
        down *= i + 1
        down %= mod
    down = pow_mod(down, mod - 2, mod)
    return (up * down) % mod

def pow_mod(n, k, mod):
    res = 1
    while True:
        if k // 2 >= 1:
            if k % 2 == 1:
                res = (res * n) % mod
            n = (n ** 2) % mod
            k = k // 2
        else:
            break
    return (n * res) % mod


if __name__ == "__main__":
    run()