from collections import defaultdict


def combination(a, b):
    if b > a - b:
        return combination(a, a - b)
    return fact[a] * ifact[b] * ifact[a-b]


MOD = 10**9+7
n, k = map(int, input().split())
k = min(k, n-1)
# 階乗を前処理
fact = defaultdict(int)
fact[0] = 1
for i in range(1, n+1):
    fact[i] = fact[i-1] * i
    fact[i] %= MOD
# 階乗の逆元を前処理
ifact = defaultdict(int)
ifact[n] = pow(fact[n], MOD-2, MOD)
for i in reversed(range(1, n + 1)):
    ifact[i-1] = ifact[i] * i
    ifact[i-1] %= MOD

ans = 0
for i in range(k+1):
    ans += combination(n, i) * combination((n-i-1)+i, i)
    ans %= MOD

print(ans % MOD) from collections import defaultdict def combination(a, b):
    if b > a - b:
        return combination(a, a - b)
    return fact[a] * ifact[b] * ifact[a-b] combination if b > a - b:
        return combination(a, a - b)
     b > a - b b a - b a b return combination(a, a - b) combination(a, a - b) combination a a - b a b return fact[a] * ifact[b] * ifact[a-b] fact[a] * ifact[b] * ifact[a-b] fact[a] * ifact[b] fact[a] fact a ifact[b] ifact b ifact[a-b] ifact a-b a b a a b b MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k k = min(k, n-1) k min(k, n-1) min k n-1 n 1 fact = defaultdict(int) fact defaultdict(int) defaultdict int fact[0] = 1 fact[0] fact 0 1 for i in range(1, n+1):
    fact[i] = fact[i-1] * i
    fact[i] %= MOD
# 階乗の逆元を前処理 i range(1, n+1) range 1 n+1 n 1 fact[i] = fact[i-1] * i fact[i] fact i fact[i-1] * i fact[i-1] fact i-1 i 1 i fact[i] %= MOD fact[i] fact i MOD ifact = defaultdict(int) ifact defaultdict(int) defaultdict int ifact[n] = pow(fact[n], MOD-2, MOD) ifact[n] ifact n pow(fact[n], MOD-2, MOD) pow fact[n] fact n MOD-2 MOD 2 MOD for i in reversed(range(1, n + 1)):
    ifact[i-1] = ifact[i] * i
    ifact[i-1] %= MOD i reversed(range(1, n + 1)) reversed range(1, n + 1) range 1 n + 1 n 1 ifact[i-1] = ifact[i] * i ifact[i-1] ifact i-1 i 1 ifact[i] * i ifact[i] ifact i i ifact[i-1] %= MOD ifact[i-1] ifact i-1 i 1 MOD ans = 0 ans 0 for i in range(k+1):
    ans += combination(n, i) * combination((n-i-1)+i, i)
    ans %= MOD i range(k+1) range k+1 k 1 ans += combination(n, i) * combination((n-i-1)+i, i) ans combination(n, i) * combination((n-i-1)+i, i) combination(n, i) combination n i combination((n-i-1)+i, i) combination (n-i-1)+i n-i-1 n-i n i 1 i i ans %= MOD ans MOD print(ans % MOD) print ans % MOD ans MOD MOD = 10**9+7 10**9+7 MOD ifact = defaultdict(int) defaultdict(int) ifact def combination(a, b):
    if b > a - b:
        return combination(a, a - b)
    return fact[a] * ifact[b] * ifact[a-b] def combination(a, b):
    if b > a - b:
        return combination(a, a - b)
    return fact[a] * ifact[b] * ifact[a-b] combination n, k = map(int, input().split()) map(int, input().split()) n ans %= MOD MOD ans k = min(k, n-1) min(k, n-1) k fact = defaultdict(int) defaultdict(int) fact ans += combination(n, i) * combination((n-i-1)+i, i) combination(n, i) * combination((n-i-1)+i, i) ans k = map(int, input().split()) map(int, input().split()) k ans = 0 0 ans
from collections import defaultdict


def combination(a, b):
    if b > a - b:
        return combination(a, a - b)
    return fact[a] * ifact[b] * ifact[a-b]


MOD = 10**9+7
n, k = map(int, input().split())
k = min(k, n-1)
# 階乗を前処理
fact = defaultdict(int)
fact[0] = 1
for i in range(1, n+1):
    fact[i] = fact[i-1] * i
    fact[i] %= MOD
# 階乗の逆元を前処理
ifact = defaultdict(int)
ifact[n] = pow(fact[n], MOD-2, MOD)
for i in reversed(range(1, n + 1)):
    ifact[i-1] = ifact[i] * i
    ifact[i-1] %= MOD

ans = 0
for i in range(k+1):
    ans += combination(n, i) * combination((n-i-1)+i, i)
    ans %= MOD

print(ans % MOD)
