from sys import stdin



def prepare(n, p):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # factinv 計算用
    for i in range(2, n + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    return fact, factinv


def cmb(n, r, p, fact, factinv):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p


def get_result(data):
    n, k = data
    mod = 10**9+7
    fact, factinv = prepare(n, mod)
    ans = 0
    for m in range(n):
        # xHy = x+y−1Cx−1
        if m <= k:
            ans += (cmb(n, m, mod, fact, factinv) * cmb(n-1, n-m-1, mod, fact, factinv)) % mod
    ans %= mod
    return ans

if __name__ == '__main__':
    data = list(map(int, stdin.readline().split(' ')))
    result = get_result(data)
    print(result) from sys import stdin def prepare(n, p):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # factinv 計算用
    for i in range(2, n + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    return fact, factinv prepare fact = [1, 1] fact [1, 1] 1 1 factinv = [1, 1] factinv [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, n + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
     i range(2, n + 1) range 2 n + 1 n 1 fact.append((fact[-1] * i) % p) fact.append fact append (fact[-1] * i) % p fact[-1] * i fact[-1] fact -1 i p inv.append((-inv[p % i] * (p // i)) % p) inv.append inv append (-inv[p % i] * (p // i)) % p -inv[p % i] * (p // i) -inv[p % i] inv[p % i] inv p % i p i p // i p i p factinv.append((factinv[-1] * inv[-1]) % p) factinv.append factinv append (factinv[-1] * inv[-1]) % p factinv[-1] * inv[-1] factinv[-1] factinv -1 inv[-1] inv -1 p return fact, factinv return fact, factinv fact factinv n n p p def cmb(n, r, p, fact, factinv):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p cmb if (r < 0) or (n < r):
        return 0
     (r < 0) or (n < r) r < 0 r 0 n < r n r return 0 0 r = min(r, n - r) r min(r, n - r) min r n - r n r return fact[n] * factinv[r] * factinv[n-r] % p fact[n] * factinv[r] * factinv[n-r] % p fact[n] * factinv[r] * factinv[n-r] fact[n] * factinv[r] fact[n] fact n factinv[r] factinv r factinv[n-r] factinv n-r n r p n n r r p p fact fact factinv factinv def get_result(data):
    n, k = data
    mod = 10**9+7
    fact, factinv = prepare(n, mod)
    ans = 0
    for m in range(n):
        # xHy = x+y−1Cx−1
        if m <= k:
            ans += (cmb(n, m, mod, fact, factinv) * cmb(n-1, n-m-1, mod, fact, factinv)) % mod
    ans %= mod
    return ans get_result n, k = data n data k mod = 10**9+7 mod 10**9+7 10**9 10 9 7 fact, factinv = prepare(n, mod) fact prepare(n, mod) prepare n mod factinv ans = 0 ans 0 for m in range(n):
        # xHy = x+y−1Cx−1
        if m <= k:
            ans += (cmb(n, m, mod, fact, factinv) * cmb(n-1, n-m-1, mod, fact, factinv)) % mod
     m range(n) range n if m <= k:
            ans += (cmb(n, m, mod, fact, factinv) * cmb(n-1, n-m-1, mod, fact, factinv)) % mod
     m <= k m k ans += (cmb(n, m, mod, fact, factinv) * cmb(n-1, n-m-1, mod, fact, factinv)) % mod ans (cmb(n, m, mod, fact, factinv) * cmb(n-1, n-m-1, mod, fact, factinv)) % mod cmb(n, m, mod, fact, factinv) * cmb(n-1, n-m-1, mod, fact, factinv) cmb(n, m, mod, fact, factinv) cmb n m mod fact factinv cmb(n-1, n-m-1, mod, fact, factinv) cmb n-1 n 1 n-m-1 n-m n m 1 mod fact factinv mod ans %= mod ans mod return ans ans data data if __name__ == '__main__':
    data = list(map(int, stdin.readline().split(' ')))
    result = get_result(data)
    print(result) __name__ == '__main__' __name__ '__main__' data = list(map(int, stdin.readline().split(' '))) data list(map(int, stdin.readline().split(' '))) list map(int, stdin.readline().split(' ')) map int stdin.readline().split(' ') stdin.readline().split stdin.readline() stdin.readline stdin readline split ' ' result = get_result(data) result get_result(data) get_result data print(result) print result def prepare(n, p):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # factinv 計算用
    for i in range(2, n + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    return fact, factinv def prepare(n, p):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # factinv 計算用
    for i in range(2, n + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    return fact, factinv prepare def cmb(n, r, p, fact, factinv):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p def cmb(n, r, p, fact, factinv):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p cmb data = list(map(int, stdin.readline().split(' '))) list(map(int, stdin.readline().split(' '))) data def get_result(data):
    n, k = data
    mod = 10**9+7
    fact, factinv = prepare(n, mod)
    ans = 0
    for m in range(n):
        # xHy = x+y−1Cx−1
        if m <= k:
            ans += (cmb(n, m, mod, fact, factinv) * cmb(n-1, n-m-1, mod, fact, factinv)) % mod
    ans %= mod
    return ans def get_result(data):
    n, k = data
    mod = 10**9+7
    fact, factinv = prepare(n, mod)
    ans = 0
    for m in range(n):
        # xHy = x+y−1Cx−1
        if m <= k:
            ans += (cmb(n, m, mod, fact, factinv) * cmb(n-1, n-m-1, mod, fact, factinv)) % mod
    ans %= mod
    return ans get_result result = get_result(data) get_result(data) result
from sys import stdin



def prepare(n, p):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # factinv 計算用
    for i in range(2, n + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    return fact, factinv


def cmb(n, r, p, fact, factinv):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p


def get_result(data):
    n, k = data
    mod = 10**9+7
    fact, factinv = prepare(n, mod)
    ans = 0
    for m in range(n):
        # xHy = x+y−1Cx−1
        if m <= k:
            ans += (cmb(n, m, mod, fact, factinv) * cmb(n-1, n-m-1, mod, fact, factinv)) % mod
    ans %= mod
    return ans

if __name__ == '__main__':
    data = list(map(int, stdin.readline().split(' ')))
    result = get_result(data)
    print(result)