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

MOD = 10**9+7
fact, fact_inv = prepare(3*10**5, MOD)

n, k = map(int,input().split())

k = min(n-1, k)

ans = 1
for i in range(1,k+1):
    z = fact[n] * fact_inv[i] % MOD * fact_inv[n-i] % MOD
    p = fact[n-1] * fact_inv[n-i-1] % MOD * fact_inv[i] % MOD
    ans += z * p % MOD
    ans %= MOD
print(ans) 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 MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 fact, fact_inv = prepare(3*10**5, MOD) fact prepare(3*10**5, MOD) prepare 3*10**5 3 10**5 10 5 MOD fact_inv n, k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k k = min(n-1, k) k min(n-1, k) min n-1 n 1 k ans = 1 ans 1 for i in range(1,k+1):
    z = fact[n] * fact_inv[i] % MOD * fact_inv[n-i] % MOD
    p = fact[n-1] * fact_inv[n-i-1] % MOD * fact_inv[i] % MOD
    ans += z * p % MOD
    ans %= MOD i range(1,k+1) range 1 k+1 k 1 z = fact[n] * fact_inv[i] % MOD * fact_inv[n-i] % MOD z fact[n] * fact_inv[i] % MOD * fact_inv[n-i] % MOD fact[n] * fact_inv[i] % MOD * fact_inv[n-i] fact[n] * fact_inv[i] % MOD fact[n] * fact_inv[i] fact[n] fact n fact_inv[i] fact_inv i MOD fact_inv[n-i] fact_inv n-i n i MOD p = fact[n-1] * fact_inv[n-i-1] % MOD * fact_inv[i] % MOD p fact[n-1] * fact_inv[n-i-1] % MOD * fact_inv[i] % MOD fact[n-1] * fact_inv[n-i-1] % MOD * fact_inv[i] fact[n-1] * fact_inv[n-i-1] % MOD fact[n-1] * fact_inv[n-i-1] fact[n-1] fact n-1 n 1 fact_inv[n-i-1] fact_inv n-i-1 n-i n i 1 MOD fact_inv[i] fact_inv i MOD ans += z * p % MOD ans z * p % MOD z * p z p MOD ans %= MOD ans MOD print(ans) print ans k = min(n-1, k) min(n-1, k) k fact_inv = prepare(3*10**5, MOD) prepare(3*10**5, MOD) fact_inv k = map(int,input().split()) map(int,input().split()) k n, k = map(int,input().split()) map(int,input().split()) n 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 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 p = fact[n-1] * fact_inv[n-i-1] % MOD * fact_inv[i] % MOD fact[n-1] * fact_inv[n-i-1] % MOD * fact_inv[i] % MOD p fact, fact_inv = prepare(3*10**5, MOD) prepare(3*10**5, MOD) fact ans += z * p % MOD z * p % MOD ans ans = 1 1 ans z = fact[n] * fact_inv[i] % MOD * fact_inv[n-i] % MOD fact[n] * fact_inv[i] % MOD * fact_inv[n-i] % MOD z ans %= MOD MOD ans MOD = 10**9+7 10**9+7 MOD
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

MOD = 10**9+7
fact, fact_inv = prepare(3*10**5, MOD)

n, k = map(int,input().split())

k = min(n-1, k)

ans = 1
for i in range(1,k+1):
    z = fact[n] * fact_inv[i] % MOD * fact_inv[n-i] % MOD
    p = fact[n-1] * fact_inv[n-i-1] % MOD * fact_inv[i] % MOD
    ans += z * p % MOD
    ans %= MOD
print(ans)