import sys

N_MAX = 200000 + 5
sys.setrecursionlimit(N_MAX)
MOD = 10**9 + 7

# ## COMBINATION (MOD) ## #

fac = [1, 1]  # 元テーブル
facinv = [1, 1]  # 逆元テーブル
inv = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N_MAX + 1):
    fac.append((fac[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    facinv.append((facinv[-1] * inv[-1]) % MOD)


def cmb(n, r):
    if (r < 0 or r > n):
        return 0
    # r = min(r, n-r)
    return fac[n] * facinv[r] * facinv[n - r] % MOD


def main():
    n, k = map(int, sys.stdin.readline().rstrip().split())

    k = min(n, k)

    ans = 0
    for m in range(k+1):
        empty = cmb(n, m)
        member = cmb(n - 1, n - m - 1)
        ans += (empty * member) % MOD
        ans %= MOD

    print(ans)


main() import sys sys N_MAX = 200000 + 5 N_MAX 200000 + 5 200000 5 sys.setrecursionlimit(N_MAX) sys.setrecursionlimit sys setrecursionlimit N_MAX MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 fac = [1, 1] fac [1, 1] 1 1 facinv = [1, 1] facinv [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, N_MAX + 1):
    fac.append((fac[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    facinv.append((facinv[-1] * inv[-1]) % MOD) i range(2, N_MAX + 1) range 2 N_MAX + 1 N_MAX 1 fac.append((fac[-1] * i) % MOD) fac.append fac append (fac[-1] * i) % MOD fac[-1] * i fac[-1] fac -1 i MOD inv.append((-inv[MOD % i] * (MOD // i)) % MOD) inv.append inv append (-inv[MOD % i] * (MOD // i)) % MOD -inv[MOD % i] * (MOD // i) -inv[MOD % i] inv[MOD % i] inv MOD % i MOD i MOD // i MOD i MOD facinv.append((facinv[-1] * inv[-1]) % MOD) facinv.append facinv append (facinv[-1] * inv[-1]) % MOD facinv[-1] * inv[-1] facinv[-1] facinv -1 inv[-1] inv -1 MOD def cmb(n, r):
    if (r < 0 or r > n):
        return 0
    # r = min(r, n-r)
    return fac[n] * facinv[r] * facinv[n - r] % MOD cmb if (r < 0 or r > n):
        return 0
    # r = min(r, n-r)
     r < 0 or r > n r < 0 r 0 r > n r n return 0 0 return fac[n] * facinv[r] * facinv[n - r] % MOD fac[n] * facinv[r] * facinv[n - r] % MOD fac[n] * facinv[r] * facinv[n - r] fac[n] * facinv[r] fac[n] fac n facinv[r] facinv r facinv[n - r] facinv n - r n r MOD n n r r def main():
    n, k = map(int, sys.stdin.readline().rstrip().split())

    k = min(n, k)

    ans = 0
    for m in range(k+1):
        empty = cmb(n, m)
        member = cmb(n - 1, n - m - 1)
        ans += (empty * member) % MOD
        ans %= MOD

    print(ans) main n, k = map(int, sys.stdin.readline().rstrip().split()) n map(int, sys.stdin.readline().rstrip().split()) map int sys.stdin.readline().rstrip().split() 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 k k = min(n, k) k min(n, k) min n k ans = 0 ans 0 for m in range(k+1):
        empty = cmb(n, m)
        member = cmb(n - 1, n - m - 1)
        ans += (empty * member) % MOD
        ans %= MOD

     m range(k+1) range k+1 k 1 empty = cmb(n, m) empty cmb(n, m) cmb n m member = cmb(n - 1, n - m - 1) member cmb(n - 1, n - m - 1) cmb n - 1 n 1 n - m - 1 n - m n m 1 ans += (empty * member) % MOD ans (empty * member) % MOD empty * member empty member MOD ans %= MOD ans MOD print(ans) print ans main() main MOD = 10**9 + 7 10**9 + 7 MOD def cmb(n, r):
    if (r < 0 or r > n):
        return 0
    # r = min(r, n-r)
    return fac[n] * facinv[r] * facinv[n - r] % MOD def cmb(n, r):
    if (r < 0 or r > n):
        return 0
    # r = min(r, n-r)
    return fac[n] * facinv[r] * facinv[n - r] % MOD cmb def main():
    n, k = map(int, sys.stdin.readline().rstrip().split())

    k = min(n, k)

    ans = 0
    for m in range(k+1):
        empty = cmb(n, m)
        member = cmb(n - 1, n - m - 1)
        ans += (empty * member) % MOD
        ans %= MOD

    print(ans) def main():
    n, k = map(int, sys.stdin.readline().rstrip().split())

    k = min(n, k)

    ans = 0
    for m in range(k+1):
        empty = cmb(n, m)
        member = cmb(n - 1, n - m - 1)
        ans += (empty * member) % MOD
        ans %= MOD

    print(ans) main facinv = [1, 1] [1, 1] facinv N_MAX = 200000 + 5 200000 + 5 N_MAX inv = [0, 1] [0, 1] inv fac = [1, 1] [1, 1] fac
import sys

N_MAX = 200000 + 5
sys.setrecursionlimit(N_MAX)
MOD = 10**9 + 7

# ## COMBINATION (MOD) ## #

fac = [1, 1]  # 元テーブル
facinv = [1, 1]  # 逆元テーブル
inv = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N_MAX + 1):
    fac.append((fac[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    facinv.append((facinv[-1] * inv[-1]) % MOD)


def cmb(n, r):
    if (r < 0 or r > n):
        return 0
    # r = min(r, n-r)
    return fac[n] * facinv[r] * facinv[n - r] % MOD


def main():
    n, k = map(int, sys.stdin.readline().rstrip().split())

    k = min(n, k)

    ans = 0
    for m in range(k+1):
        empty = cmb(n, m)
        member = cmb(n - 1, n - m - 1)
        ans += (empty * member) % MOD
        ans %= MOD

    print(ans)


main()
