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


fac = [0]*(n+1)
finv = [0]*(n+1)
inv = [0]*(n+1)
answer = 0
# テーブルを作る前処理
def COMinit(n, MOD):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, n+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
# 二項係数計算
def COM(n, k):
    if (n < k): return 0
    if (n < 0 or k < 0): return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


COMinit(n, MOD)

fac = tuple(fac)
finv = tuple(finv)
inv = tuple(inv)

a = n if n < k else k + 1

for i in range(a):
    answer += COM(n,i) * COM(n-1, n-i-1)
    # print(answer)
print(answer%MOD) MOD = 1000000007 MOD 1000000007 n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k fac = [0]*(n+1) fac [0]*(n+1) [0] 0 n+1 n 1 finv = [0]*(n+1) finv [0]*(n+1) [0] 0 n+1 n 1 inv = [0]*(n+1) inv [0]*(n+1) [0] 0 n+1 n 1 answer = 0 answer 0 def COMinit(n, MOD):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, n+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
# 二項係数計算 COMinit fac[0] = fac[1] = 1 fac[0] fac 0 1 = fac[1] = 1 fac[1] fac 1 1 finv[0] = finv[1] = 1 finv[0] finv 0 1 = finv[1] = 1 finv[1] finv 1 1 inv[1] = 1 inv[1] inv 1 1 for i in range(2, n+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
# 二項係数計算 i range(2, n+1) range 2 n+1 n 1 fac[i] = fac[i - 1] * i % MOD fac[i] fac i fac[i - 1] * i % MOD fac[i - 1] * i fac[i - 1] fac i - 1 i 1 i MOD inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD inv[i] inv i MOD - inv[MOD%i] * (MOD // i) % MOD MOD inv[MOD%i] * (MOD // i) % MOD inv[MOD%i] * (MOD // i) inv[MOD%i] inv MOD%i MOD i MOD // i MOD i MOD finv[i] = finv[i - 1] * inv[i] % MOD finv[i] finv i finv[i - 1] * inv[i] % MOD finv[i - 1] * inv[i] finv[i - 1] finv i - 1 i 1 inv[i] inv i MOD n n MOD MOD def COM(n, k):
    if (n < k): return 0
    if (n < 0 or k < 0): return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD COM if (n < k): return 0
     n < k n k if (n < 0 or k < 0): return 0
     n < 0 or k < 0 n < 0 n 0 k < 0 k 0 return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD fac[n] * (finv[k] * finv[n - k] % MOD) % MOD fac[n] * (finv[k] * finv[n - k] % MOD) fac[n] fac n finv[k] * finv[n - k] % MOD finv[k] * finv[n - k] finv[k] finv k finv[n - k] finv n - k n k MOD MOD n n k k COMinit(n, MOD) COMinit n MOD fac = tuple(fac) fac tuple(fac) tuple fac finv = tuple(finv) finv tuple(finv) tuple finv inv = tuple(inv) inv tuple(inv) tuple inv a = n if n < k else k + 1 a n if n < k else k + 1 n < k n k n k + 1 k 1 for i in range(a):
    answer += COM(n,i) * COM(n-1, n-i-1)
    # print(answer) i range(a) range a answer += COM(n,i) * COM(n-1, n-i-1) answer COM(n,i) * COM(n-1, n-i-1) COM(n,i) COM n i COM(n-1, n-i-1) COM n-1 n 1 n-i-1 n-i n i 1 print(answer%MOD) print answer%MOD answer MOD def COM(n, k):
    if (n < k): return 0
    if (n < 0 or k < 0): return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD def COM(n, k):
    if (n < k): return 0
    if (n < 0 or k < 0): return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD COM inv = tuple(inv) tuple(inv) inv fac = [0]*(n+1) [0]*(n+1) fac inv = [0]*(n+1) [0]*(n+1) inv fac = tuple(fac) tuple(fac) fac answer = 0 0 answer def COMinit(n, MOD):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, n+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
# 二項係数計算 def COMinit(n, MOD):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, n+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
# 二項係数計算 COMinit k = map(int,input().split()) map(int,input().split()) k finv = tuple(finv) tuple(finv) finv a = n if n < k else k + 1 n if n < k else k + 1 a MOD = 1000000007 1000000007 MOD n,k = map(int,input().split()) map(int,input().split()) n finv = [0]*(n+1) [0]*(n+1) finv answer += COM(n,i) * COM(n-1, n-i-1) COM(n,i) * COM(n-1, n-i-1) answer
MOD = 1000000007
n,k = map(int,input().split())


fac = [0]*(n+1)
finv = [0]*(n+1)
inv = [0]*(n+1)
answer = 0
# テーブルを作る前処理
def COMinit(n, MOD):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, n+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
# 二項係数計算
def COM(n, k):
    if (n < k): return 0
    if (n < 0 or k < 0): return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


COMinit(n, MOD)

fac = tuple(fac)
finv = tuple(finv)
inv = tuple(inv)

a = n if n < k else k + 1

for i in range(a):
    answer += COM(n,i) * COM(n-1, n-i-1)
    # print(answer)
print(answer%MOD)
