import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)


def read_values():
    return map(int, input().split())


def read_index():
    return map(lambda x: x - 1, map(int, input().split()))


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def functional(N, mod):
    F = [1] * (N + 1)
    for i in range(N):
        F[i + 1] = (i + 1) * F[i] % mod
    return F


INV = dict()
def inv(a, mod):
    if a in INV:
        return INV[a]
    i = pow(a, mod - 2, mod)
    INV[a] = i
    return i 


def C(F, a, b, mod):
    return F[a] * inv(F[a - b], mod) * inv(F[b], mod) % mod 


def main():
    N, K = read_values()
    mod = 10 ** 9 + 7
    F = functional(5 * 10 ** 5, mod)
    res = 0
    if N <= K:
        res = C(F, 2 * N - 1, N - 1, mod)
    else:
        c = C(F, N - 1, 0, mod)
        for k in range(K + 1):
            res += pow(c, 2, mod) * N * inv(N - k, mod) % mod
            c *= ((N - k - 1) * inv(k + 1, mod)) % mod
            c %= mod
    
    print(res % mod)

if __name__ == "__main__":
    main() import sys sys import itertools itertools input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(100000) sys.setrecursionlimit sys setrecursionlimit 100000 def read_values():
    return map(int, input().split()) read_values return map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split def read_index():
    return map(lambda x: x - 1, map(int, input().split())) read_index return map(lambda x: x - 1, map(int, input().split())) map(lambda x: x - 1, map(int, input().split())) map lambda x: x - 1 x - 1 x 1 x map(int, input().split()) map int input().split() ().split () input split def read_list():
    return list(read_values()) read_list return list(read_values()) list(read_values()) list read_values() read_values def read_lists(N):
    return [read_list() for n in range(N)] read_lists read_list() for n in range(N) for n in range(N) n range(N) range N for n in range(N) read_list() read_list return [read_list() for n in range(N)] [read_list() for n in range(N)] N N def functional(N, mod):
    F = [1] * (N + 1)
    for i in range(N):
        F[i + 1] = (i + 1) * F[i] % mod
    return F functional F = [1] * (N + 1) F [1] * (N + 1) [1] 1 N + 1 N 1 for i in range(N):
        F[i + 1] = (i + 1) * F[i] % mod
     i range(N) range N F[i + 1] = (i + 1) * F[i] % mod F[i + 1] F i + 1 i 1 (i + 1) * F[i] % mod (i + 1) * F[i] i + 1 i 1 F[i] F i mod return F F N N mod mod INV = dict() INV dict() dict def inv(a, mod):
    if a in INV:
        return INV[a]
    i = pow(a, mod - 2, mod)
    INV[a] = i
    return i  inv if a in INV:
        return INV[a]
     a in INV a INV return INV[a] INV[a] INV a i = pow(a, mod - 2, mod) i pow(a, mod - 2, mod) pow a mod - 2 mod 2 mod INV[a] = i INV[a] INV a i return i i a a mod mod def C(F, a, b, mod):
    return F[a] * inv(F[a - b], mod) * inv(F[b], mod) % mod  C return F[a] * inv(F[a - b], mod) * inv(F[b], mod) % mod F[a] * inv(F[a - b], mod) * inv(F[b], mod) % mod F[a] * inv(F[a - b], mod) * inv(F[b], mod) F[a] * inv(F[a - b], mod) F[a] F a inv(F[a - b], mod) inv F[a - b] F a - b a b mod inv(F[b], mod) inv F[b] F b mod mod F F a a b b mod mod def main():
    N, K = read_values()
    mod = 10 ** 9 + 7
    F = functional(5 * 10 ** 5, mod)
    res = 0
    if N <= K:
        res = C(F, 2 * N - 1, N - 1, mod)
    else:
        c = C(F, N - 1, 0, mod)
        for k in range(K + 1):
            res += pow(c, 2, mod) * N * inv(N - k, mod) % mod
            c *= ((N - k - 1) * inv(k + 1, mod)) % mod
            c %= mod
    
    print(res % mod) main N, K = read_values() N read_values() read_values K mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 F = functional(5 * 10 ** 5, mod) F functional(5 * 10 ** 5, mod) functional 5 * 10 ** 5 5 10 ** 5 10 5 mod res = 0 res 0 if N <= K:
        res = C(F, 2 * N - 1, N - 1, mod)
    else:
        c = C(F, N - 1, 0, mod)
        for k in range(K + 1):
            res += pow(c, 2, mod) * N * inv(N - k, mod) % mod
            c *= ((N - k - 1) * inv(k + 1, mod)) % mod
            c %= mod
    
     N <= K N K res = C(F, 2 * N - 1, N - 1, mod) res C(F, 2 * N - 1, N - 1, mod) C F 2 * N - 1 2 * N 2 N 1 N - 1 N 1 mod c = C(F, N - 1, 0, mod) c C(F, N - 1, 0, mod) C F N - 1 N 1 0 mod for k in range(K + 1):
            res += pow(c, 2, mod) * N * inv(N - k, mod) % mod
            c *= ((N - k - 1) * inv(k + 1, mod)) % mod
            c %= mod
    
     k range(K + 1) range K + 1 K 1 res += pow(c, 2, mod) * N * inv(N - k, mod) % mod res pow(c, 2, mod) * N * inv(N - k, mod) % mod pow(c, 2, mod) * N * inv(N - k, mod) pow(c, 2, mod) * N pow(c, 2, mod) pow c 2 mod N inv(N - k, mod) inv N - k N k mod mod c *= ((N - k - 1) * inv(k + 1, mod)) % mod c ((N - k - 1) * inv(k + 1, mod)) % mod (N - k - 1) * inv(k + 1, mod) N - k - 1 N - k N k 1 inv(k + 1, mod) inv k + 1 k 1 mod mod c %= mod c mod print(res % mod) print res % mod res mod if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def read_index():
    return map(lambda x: x - 1, map(int, input().split())) def read_index():
    return map(lambda x: x - 1, map(int, input().split())) read_index def read_lists(N):
    return [read_list() for n in range(N)] def read_lists(N):
    return [read_list() for n in range(N)] read_lists input = sys.stdin.readline sys.stdin.readline input def functional(N, mod):
    F = [1] * (N + 1)
    for i in range(N):
        F[i + 1] = (i + 1) * F[i] % mod
    return F def functional(N, mod):
    F = [1] * (N + 1)
    for i in range(N):
        F[i + 1] = (i + 1) * F[i] % mod
    return F functional def main():
    N, K = read_values()
    mod = 10 ** 9 + 7
    F = functional(5 * 10 ** 5, mod)
    res = 0
    if N <= K:
        res = C(F, 2 * N - 1, N - 1, mod)
    else:
        c = C(F, N - 1, 0, mod)
        for k in range(K + 1):
            res += pow(c, 2, mod) * N * inv(N - k, mod) % mod
            c *= ((N - k - 1) * inv(k + 1, mod)) % mod
            c %= mod
    
    print(res % mod) def main():
    N, K = read_values()
    mod = 10 ** 9 + 7
    F = functional(5 * 10 ** 5, mod)
    res = 0
    if N <= K:
        res = C(F, 2 * N - 1, N - 1, mod)
    else:
        c = C(F, N - 1, 0, mod)
        for k in range(K + 1):
            res += pow(c, 2, mod) * N * inv(N - k, mod) % mod
            c *= ((N - k - 1) * inv(k + 1, mod)) % mod
            c %= mod
    
    print(res % mod) main def read_values():
    return map(int, input().split()) def read_values():
    return map(int, input().split()) read_values def inv(a, mod):
    if a in INV:
        return INV[a]
    i = pow(a, mod - 2, mod)
    INV[a] = i
    return i  def inv(a, mod):
    if a in INV:
        return INV[a]
    i = pow(a, mod - 2, mod)
    INV[a] = i
    return i  inv def read_list():
    return list(read_values()) def read_list():
    return list(read_values()) read_list INV = dict() dict() INV def C(F, a, b, mod):
    return F[a] * inv(F[a - b], mod) * inv(F[b], mod) % mod  def C(F, a, b, mod):
    return F[a] * inv(F[a - b], mod) * inv(F[b], mod) % mod  C
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)


def read_values():
    return map(int, input().split())


def read_index():
    return map(lambda x: x - 1, map(int, input().split()))


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def functional(N, mod):
    F = [1] * (N + 1)
    for i in range(N):
        F[i + 1] = (i + 1) * F[i] % mod
    return F


INV = dict()
def inv(a, mod):
    if a in INV:
        return INV[a]
    i = pow(a, mod - 2, mod)
    INV[a] = i
    return i 


def C(F, a, b, mod):
    return F[a] * inv(F[a - b], mod) * inv(F[b], mod) % mod 


def main():
    N, K = read_values()
    mod = 10 ** 9 + 7
    F = functional(5 * 10 ** 5, mod)
    res = 0
    if N <= K:
        res = C(F, 2 * N - 1, N - 1, mod)
    else:
        c = C(F, N - 1, 0, mod)
        for k in range(K + 1):
            res += pow(c, 2, mod) * N * inv(N - k, mod) % mod
            c *= ((N - k - 1) * inv(k + 1, mod)) % mod
            c %= mod
    
    print(res % mod)

if __name__ == "__main__":
    main()