import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===
def main():
    # nCrの左項にはn以外も来るバージョン、1!～(n-1)!を保持
    def prepare(n, MOD):
        # 1! - n! の計算
        f = 1
        factorials = [1]  # 0!の分
        for m in range(1, n + 1):
            f *= m
            f %= MOD
            factorials.append(f)
        # n!^-1 の計算
        inv = pow(f, MOD - 2, MOD)
        # n!^-1 - 1!^-1 の計算
        invs = [1] * (n + 1)
        invs[n] = inv
        for m in range(n, 1, -1):
            inv *= m
            inv %= MOD
            invs[m - 1] = inv

        return factorials, invs

    n, k = ns()
    facts, invs = prepare(n, MOD)

    ans = 0
    for ki in range(min(n, k + 1)):
        zero_comb = facts[n] * invs[ki] * invs[n - ki] % MOD
        nonzero_comb = facts[n - 1] * invs[ki] * invs[n - 1 - ki] % MOD
        ans += zero_comb * nonzero_comb % MOD
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main() import sys sys import math math import collections collections import bisect bisect import itertools itertools import fractions fractions import copy copy import decimal decimal import queue queue sys.setrecursionlimit(10000001) sys.setrecursionlimit sys setrecursionlimit 10000001 INF = 10 ** 16 INF 10 ** 16 10 16 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 ni = lambda: int(sys.stdin.readline()) ni lambda: int(sys.stdin.readline()) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline ns = lambda: map(int, sys.stdin.readline().split()) ns lambda: map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split na = lambda: list(map(int, sys.stdin.readline().split())) na lambda: list(map(int, sys.stdin.readline().split())) list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split def main():
    # nCrの左項にはn以外も来るバージョン、1!～(n-1)!を保持
    def prepare(n, MOD):
        # 1! - n! の計算
        f = 1
        factorials = [1]  # 0!の分
        for m in range(1, n + 1):
            f *= m
            f %= MOD
            factorials.append(f)
        # n!^-1 の計算
        inv = pow(f, MOD - 2, MOD)
        # n!^-1 - 1!^-1 の計算
        invs = [1] * (n + 1)
        invs[n] = inv
        for m in range(n, 1, -1):
            inv *= m
            inv %= MOD
            invs[m - 1] = inv

        return factorials, invs

    n, k = ns()
    facts, invs = prepare(n, MOD)

    ans = 0
    for ki in range(min(n, k + 1)):
        zero_comb = facts[n] * invs[ki] * invs[n - ki] % MOD
        nonzero_comb = facts[n - 1] * invs[ki] * invs[n - 1 - ki] % MOD
        ans += zero_comb * nonzero_comb % MOD
        ans %= MOD

    print(ans) main def prepare(n, MOD):
        # 1! - n! の計算
        f = 1
        factorials = [1]  # 0!の分
        for m in range(1, n + 1):
            f *= m
            f %= MOD
            factorials.append(f)
        # n!^-1 の計算
        inv = pow(f, MOD - 2, MOD)
        # n!^-1 - 1!^-1 の計算
        invs = [1] * (n + 1)
        invs[n] = inv
        for m in range(n, 1, -1):
            inv *= m
            inv %= MOD
            invs[m - 1] = inv

        return factorials, invs

     prepare f = 1 f 1 factorials = [1] factorials [1] 1 for m in range(1, n + 1):
            f *= m
            f %= MOD
            factorials.append(f)
        # n!^-1 の計算
         m range(1, n + 1) range 1 n + 1 n 1 f *= m f m f %= MOD f MOD factorials.append(f) factorials.append factorials append f inv = pow(f, MOD - 2, MOD) inv pow(f, MOD - 2, MOD) pow f MOD - 2 MOD 2 MOD invs = [1] * (n + 1) invs [1] * (n + 1) [1] 1 n + 1 n 1 invs[n] = inv invs[n] invs n inv for m in range(n, 1, -1):
            inv *= m
            inv %= MOD
            invs[m - 1] = inv

         m range(n, 1, -1) range n 1 -1 inv *= m inv m inv %= MOD inv MOD invs[m - 1] = inv invs[m - 1] invs m - 1 m 1 inv return factorials, invs return factorials, invs factorials invs n n MOD MOD n, k = ns() n ns() ns k facts, invs = prepare(n, MOD) facts prepare(n, MOD) prepare n MOD invs ans = 0 ans 0 for ki in range(min(n, k + 1)):
        zero_comb = facts[n] * invs[ki] * invs[n - ki] % MOD
        nonzero_comb = facts[n - 1] * invs[ki] * invs[n - 1 - ki] % MOD
        ans += zero_comb * nonzero_comb % MOD
        ans %= MOD

     ki range(min(n, k + 1)) range min(n, k + 1) min n k + 1 k 1 zero_comb = facts[n] * invs[ki] * invs[n - ki] % MOD zero_comb facts[n] * invs[ki] * invs[n - ki] % MOD facts[n] * invs[ki] * invs[n - ki] facts[n] * invs[ki] facts[n] facts n invs[ki] invs ki invs[n - ki] invs n - ki n ki MOD nonzero_comb = facts[n - 1] * invs[ki] * invs[n - 1 - ki] % MOD nonzero_comb facts[n - 1] * invs[ki] * invs[n - 1 - ki] % MOD facts[n - 1] * invs[ki] * invs[n - 1 - ki] facts[n - 1] * invs[ki] facts[n - 1] facts n - 1 n 1 invs[ki] invs ki invs[n - 1 - ki] invs n - 1 - ki n - 1 n 1 ki MOD ans += zero_comb * nonzero_comb % MOD ans zero_comb * nonzero_comb % MOD zero_comb * nonzero_comb zero_comb nonzero_comb MOD ans %= MOD ans MOD print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main ni = lambda: int(sys.stdin.readline()) lambda: int(sys.stdin.readline()) ni def main():
    # nCrの左項にはn以外も来るバージョン、1!～(n-1)!を保持
    def prepare(n, MOD):
        # 1! - n! の計算
        f = 1
        factorials = [1]  # 0!の分
        for m in range(1, n + 1):
            f *= m
            f %= MOD
            factorials.append(f)
        # n!^-1 の計算
        inv = pow(f, MOD - 2, MOD)
        # n!^-1 - 1!^-1 の計算
        invs = [1] * (n + 1)
        invs[n] = inv
        for m in range(n, 1, -1):
            inv *= m
            inv %= MOD
            invs[m - 1] = inv

        return factorials, invs

    n, k = ns()
    facts, invs = prepare(n, MOD)

    ans = 0
    for ki in range(min(n, k + 1)):
        zero_comb = facts[n] * invs[ki] * invs[n - ki] % MOD
        nonzero_comb = facts[n - 1] * invs[ki] * invs[n - 1 - ki] % MOD
        ans += zero_comb * nonzero_comb % MOD
        ans %= MOD

    print(ans) def main():
    # nCrの左項にはn以外も来るバージョン、1!～(n-1)!を保持
    def prepare(n, MOD):
        # 1! - n! の計算
        f = 1
        factorials = [1]  # 0!の分
        for m in range(1, n + 1):
            f *= m
            f %= MOD
            factorials.append(f)
        # n!^-1 の計算
        inv = pow(f, MOD - 2, MOD)
        # n!^-1 - 1!^-1 の計算
        invs = [1] * (n + 1)
        invs[n] = inv
        for m in range(n, 1, -1):
            inv *= m
            inv %= MOD
            invs[m - 1] = inv

        return factorials, invs

    n, k = ns()
    facts, invs = prepare(n, MOD)

    ans = 0
    for ki in range(min(n, k + 1)):
        zero_comb = facts[n] * invs[ki] * invs[n - ki] % MOD
        nonzero_comb = facts[n - 1] * invs[ki] * invs[n - 1 - ki] % MOD
        ans += zero_comb * nonzero_comb % MOD
        ans %= MOD

    print(ans) main ns = lambda: map(int, sys.stdin.readline().split()) lambda: map(int, sys.stdin.readline().split()) ns na = lambda: list(map(int, sys.stdin.readline().split())) lambda: list(map(int, sys.stdin.readline().split())) na MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD INF = 10 ** 16 10 ** 16 INF
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===
def main():
    # nCrの左項にはn以外も来るバージョン、1!～(n-1)!を保持
    def prepare(n, MOD):
        # 1! - n! の計算
        f = 1
        factorials = [1]  # 0!の分
        for m in range(1, n + 1):
            f *= m
            f %= MOD
            factorials.append(f)
        # n!^-1 の計算
        inv = pow(f, MOD - 2, MOD)
        # n!^-1 - 1!^-1 の計算
        invs = [1] * (n + 1)
        invs[n] = inv
        for m in range(n, 1, -1):
            inv *= m
            inv %= MOD
            invs[m - 1] = inv

        return factorials, invs

    n, k = ns()
    facts, invs = prepare(n, MOD)

    ans = 0
    for ki in range(min(n, k + 1)):
        zero_comb = facts[n] * invs[ki] * invs[n - ki] % MOD
        nonzero_comb = facts[n - 1] * invs[ki] * invs[n - 1 - ki] % MOD
        ans += zero_comb * nonzero_comb % MOD
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()
