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

MOD = 10 ** 9 + 7

def factorial(n):
    global fct
    global invfct
    fct = [0] * (n + 1)
    fct[0] = 1
    for i in range(1, n+1):
        fct[i] = fct[i-1] * i % MOD
    invfct = [0] * (n + 1)
    invfct[n] = pow(fct[n], MOD - 2, MOD)
    for i in range(n-1, -1, -1):
        invfct[i] = invfct[i+1] * (i + 1) % MOD

def binomial(n, k):
    return fct[n] * invfct[n-k] % MOD * invfct[k] % MOD

factorial(2 * n)

if k >= n:
    print(binomial(2 * n - 1, n) % MOD)
else:
    answer = 0
    for i in range(k+1):
        answer += binomial(n, i) * binomial(n-1, i)
        answer %= MOD
    print(answer) n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 def factorial(n):
    global fct
    global invfct
    fct = [0] * (n + 1)
    fct[0] = 1
    for i in range(1, n+1):
        fct[i] = fct[i-1] * i % MOD
    invfct = [0] * (n + 1)
    invfct[n] = pow(fct[n], MOD - 2, MOD)
    for i in range(n-1, -1, -1):
        invfct[i] = invfct[i+1] * (i + 1) % MOD factorial global fct global invfct fct = [0] * (n + 1) fct [0] * (n + 1) [0] 0 n + 1 n 1 fct[0] = 1 fct[0] fct 0 1 for i in range(1, n+1):
        fct[i] = fct[i-1] * i % MOD
     i range(1, n+1) range 1 n+1 n 1 fct[i] = fct[i-1] * i % MOD fct[i] fct i fct[i-1] * i % MOD fct[i-1] * i fct[i-1] fct i-1 i 1 i MOD invfct = [0] * (n + 1) invfct [0] * (n + 1) [0] 0 n + 1 n 1 invfct[n] = pow(fct[n], MOD - 2, MOD) invfct[n] invfct n pow(fct[n], MOD - 2, MOD) pow fct[n] fct n MOD - 2 MOD 2 MOD for i in range(n-1, -1, -1):
        invfct[i] = invfct[i+1] * (i + 1) % MOD i range(n-1, -1, -1) range n-1 n 1 -1 -1 invfct[i] = invfct[i+1] * (i + 1) % MOD invfct[i] invfct i invfct[i+1] * (i + 1) % MOD invfct[i+1] * (i + 1) invfct[i+1] invfct i+1 i 1 i + 1 i 1 MOD n n def binomial(n, k):
    return fct[n] * invfct[n-k] % MOD * invfct[k] % MOD binomial return fct[n] * invfct[n-k] % MOD * invfct[k] % MOD fct[n] * invfct[n-k] % MOD * invfct[k] % MOD fct[n] * invfct[n-k] % MOD * invfct[k] fct[n] * invfct[n-k] % MOD fct[n] * invfct[n-k] fct[n] fct n invfct[n-k] invfct n-k n k MOD invfct[k] invfct k MOD n n k k factorial(2 * n) factorial 2 * n 2 n if k >= n:
    print(binomial(2 * n - 1, n) % MOD)
else:
    answer = 0
    for i in range(k+1):
        answer += binomial(n, i) * binomial(n-1, i)
        answer %= MOD
    print(answer) k >= n k n print(binomial(2 * n - 1, n) % MOD) print binomial(2 * n - 1, n) % MOD binomial(2 * n - 1, n) binomial 2 * n - 1 2 * n 2 n 1 n MOD answer = 0 answer 0 for i in range(k+1):
        answer += binomial(n, i) * binomial(n-1, i)
        answer %= MOD
     i range(k+1) range k+1 k 1 answer += binomial(n, i) * binomial(n-1, i) answer binomial(n, i) * binomial(n-1, i) binomial(n, i) binomial n i binomial(n-1, i) binomial n-1 n 1 i answer %= MOD answer MOD print(answer) print answer n, k = map(int, input().split()) map(int, input().split()) n def binomial(n, k):
    return fct[n] * invfct[n-k] % MOD * invfct[k] % MOD def binomial(n, k):
    return fct[n] * invfct[n-k] % MOD * invfct[k] % MOD binomial k = map(int, input().split()) map(int, input().split()) k answer += binomial(n, i) * binomial(n-1, i) binomial(n, i) * binomial(n-1, i) answer def factorial(n):
    global fct
    global invfct
    fct = [0] * (n + 1)
    fct[0] = 1
    for i in range(1, n+1):
        fct[i] = fct[i-1] * i % MOD
    invfct = [0] * (n + 1)
    invfct[n] = pow(fct[n], MOD - 2, MOD)
    for i in range(n-1, -1, -1):
        invfct[i] = invfct[i+1] * (i + 1) % MOD def factorial(n):
    global fct
    global invfct
    fct = [0] * (n + 1)
    fct[0] = 1
    for i in range(1, n+1):
        fct[i] = fct[i-1] * i % MOD
    invfct = [0] * (n + 1)
    invfct[n] = pow(fct[n], MOD - 2, MOD)
    for i in range(n-1, -1, -1):
        invfct[i] = invfct[i+1] * (i + 1) % MOD factorial answer = 0 0 answer answer %= MOD MOD answer MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD
n, k = map(int, input().split())

MOD = 10 ** 9 + 7

def factorial(n):
    global fct
    global invfct
    fct = [0] * (n + 1)
    fct[0] = 1
    for i in range(1, n+1):
        fct[i] = fct[i-1] * i % MOD
    invfct = [0] * (n + 1)
    invfct[n] = pow(fct[n], MOD - 2, MOD)
    for i in range(n-1, -1, -1):
        invfct[i] = invfct[i+1] * (i + 1) % MOD

def binomial(n, k):
    return fct[n] * invfct[n-k] % MOD * invfct[k] % MOD

factorial(2 * n)

if k >= n:
    print(binomial(2 * n - 1, n) % MOD)
else:
    answer = 0
    for i in range(k+1):
        answer += binomial(n, i) * binomial(n-1, i)
        answer %= MOD
    print(answer)
