MAX = 1000005
MOD = 10**9+7
factrial = [0]*MAX
inverse = [0]*MAX
factrial_inverse = [0]*MAX


# テーブルを作る前処理
def COMinit():
    global factrial, inverse, factrial_inverse
    factrial[0] = 1
    factrial[1] = 1
    inverse[1] = 1
    factrial_inverse[0] = 1
    factrial_inverse[1] = 1
    for i in range(2, MAX):
        factrial[i] = factrial[i-1] * i % MOD
        inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD
        factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD


# 二項係数計算
def COM(n, k):
    global factrial, inverse, factrial_inverse
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD


# 前処理完了
COMinit()


N, K = map(int, input().split())
ans = 0
for i in range(min(K, N)+1):  # 空にできるのはK部屋または、N-1部屋までのみ。
    ans += COM(N, i) * COM(N-1, i)
    ans %= MOD
print(ans) MAX = 1000005 MAX 1000005 MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 factrial = [0]*MAX factrial [0]*MAX [0] 0 MAX inverse = [0]*MAX inverse [0]*MAX [0] 0 MAX factrial_inverse = [0]*MAX factrial_inverse [0]*MAX [0] 0 MAX def COMinit():
    global factrial, inverse, factrial_inverse
    factrial[0] = 1
    factrial[1] = 1
    inverse[1] = 1
    factrial_inverse[0] = 1
    factrial_inverse[1] = 1
    for i in range(2, MAX):
        factrial[i] = factrial[i-1] * i % MOD
        inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD
        factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD


# 二項係数計算 COMinit global factrial, inverse, factrial_inverse factrial[0] = 1 factrial[0] factrial 0 1 factrial[1] = 1 factrial[1] factrial 1 1 inverse[1] = 1 inverse[1] inverse 1 1 factrial_inverse[0] = 1 factrial_inverse[0] factrial_inverse 0 1 factrial_inverse[1] = 1 factrial_inverse[1] factrial_inverse 1 1 for i in range(2, MAX):
        factrial[i] = factrial[i-1] * i % MOD
        inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD
        factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD


# 二項係数計算 i range(2, MAX) range 2 MAX factrial[i] = factrial[i-1] * i % MOD factrial[i] factrial i factrial[i-1] * i % MOD factrial[i-1] * i factrial[i-1] factrial i-1 i 1 i MOD inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD inverse[i] inverse i MOD - inverse[MOD % i] * (MOD//i) % MOD MOD inverse[MOD % i] * (MOD//i) % MOD inverse[MOD % i] * (MOD//i) inverse[MOD % i] inverse MOD % i MOD i MOD//i MOD i MOD factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD factrial_inverse[i] factrial_inverse i factrial_inverse[i-1] * inverse[i] % MOD factrial_inverse[i-1] * inverse[i] factrial_inverse[i-1] factrial_inverse i-1 i 1 inverse[i] inverse i MOD def COM(n, k):
    global factrial, inverse, factrial_inverse
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD


# 前処理完了 COM global factrial, inverse, factrial_inverse if n < k:
        return 0
     n < k n k return 0 0 if n < 0 or k < 0:
        return 0
     n < 0 or k < 0 n < 0 n 0 k < 0 k 0 return 0 0 return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) factrial[n] factrial n factrial_inverse[k] * factrial_inverse[n-k] % MOD factrial_inverse[k] * factrial_inverse[n-k] factrial_inverse[k] factrial_inverse k factrial_inverse[n-k] factrial_inverse n-k n k MOD MOD n n k k COMinit() COMinit N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K ans = 0 ans 0 for i in range(min(K, N)+1):  # 空にできるのはK部屋または、N-1部屋までのみ。
    ans += COM(N, i) * COM(N-1, i)
    ans %= MOD i range(min(K, N)+1) range min(K, N)+1 min(K, N) min K N 1 ans += COM(N, i) * COM(N-1, i) ans COM(N, i) * COM(N-1, i) COM(N, i) COM N i COM(N-1, i) COM N-1 N 1 i ans %= MOD ans MOD print(ans) print ans ans %= MOD MOD ans def COMinit():
    global factrial, inverse, factrial_inverse
    factrial[0] = 1
    factrial[1] = 1
    inverse[1] = 1
    factrial_inverse[0] = 1
    factrial_inverse[1] = 1
    for i in range(2, MAX):
        factrial[i] = factrial[i-1] * i % MOD
        inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD
        factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD


# 二項係数計算 def COMinit():
    global factrial, inverse, factrial_inverse
    factrial[0] = 1
    factrial[1] = 1
    inverse[1] = 1
    factrial_inverse[0] = 1
    factrial_inverse[1] = 1
    for i in range(2, MAX):
        factrial[i] = factrial[i-1] * i % MOD
        inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD
        factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD


# 二項係数計算 COMinit factrial = [0]*MAX [0]*MAX factrial factrial_inverse = [0]*MAX [0]*MAX factrial_inverse def COM(n, k):
    global factrial, inverse, factrial_inverse
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD


# 前処理完了 def COM(n, k):
    global factrial, inverse, factrial_inverse
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD


# 前処理完了 COM ans = 0 0 ans N, K = map(int, input().split()) map(int, input().split()) N ans += COM(N, i) * COM(N-1, i) COM(N, i) * COM(N-1, i) ans K = map(int, input().split()) map(int, input().split()) K MAX = 1000005 1000005 MAX MOD = 10**9+7 10**9+7 MOD inverse = [0]*MAX [0]*MAX inverse
MAX = 1000005
MOD = 10**9+7
factrial = [0]*MAX
inverse = [0]*MAX
factrial_inverse = [0]*MAX


# テーブルを作る前処理
def COMinit():
    global factrial, inverse, factrial_inverse
    factrial[0] = 1
    factrial[1] = 1
    inverse[1] = 1
    factrial_inverse[0] = 1
    factrial_inverse[1] = 1
    for i in range(2, MAX):
        factrial[i] = factrial[i-1] * i % MOD
        inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD
        factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD


# 二項係数計算
def COM(n, k):
    global factrial, inverse, factrial_inverse
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD


# 前処理完了
COMinit()


N, K = map(int, input().split())
ans = 0
for i in range(min(K, N)+1):  # 空にできるのはK部屋または、N-1部屋までのみ。
    ans += COM(N, i) * COM(N-1, i)
    ans %= MOD
print(ans)
