import sys
from functools import lru_cache

sys.setrecursionlimit(10 ** 7)

MOD = 10 ** 9 + 7

@lru_cache(None)
def combination(n, k):
    if k == 0:
        return 1
    else:
        return ((combination(n, k-1) * (n-k+1) % MOD) * pow(k, MOD-2, MOD)) % MOD

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

s = 0
for m in range(0, min(k+1, n)):
    s += combination(n, min(m, n - m)) * combination(n - 1, min(m, n - m - 1))
    s %= MOD

print(s) import sys sys from functools import lru_cache sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 def combination(n, k):
    if k == 0:
        return 1
    else:
        return ((combination(n, k-1) * (n-k+1) % MOD) * pow(k, MOD-2, MOD)) % MOD combination if k == 0:
        return 1
    else:
        return ((combination(n, k-1) * (n-k+1) % MOD) * pow(k, MOD-2, MOD)) % MOD k == 0 k 0 return 1 1 return ((combination(n, k-1) * (n-k+1) % MOD) * pow(k, MOD-2, MOD)) % MOD ((combination(n, k-1) * (n-k+1) % MOD) * pow(k, MOD-2, MOD)) % MOD (combination(n, k-1) * (n-k+1) % MOD) * pow(k, MOD-2, MOD) combination(n, k-1) * (n-k+1) % MOD combination(n, k-1) * (n-k+1) combination(n, k-1) combination n k-1 k 1 n-k+1 n-k n k 1 MOD pow(k, MOD-2, MOD) pow k MOD-2 MOD 2 MOD MOD n n k k @lru_cache(None) combination None @lru_cache(None) lru_cache None combination n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k s = 0 s 0 for m in range(0, min(k+1, n)):
    s += combination(n, min(m, n - m)) * combination(n - 1, min(m, n - m - 1))
    s %= MOD m range(0, min(k+1, n)) range 0 min(k+1, n) min k+1 k 1 n s += combination(n, min(m, n - m)) * combination(n - 1, min(m, n - m - 1)) s combination(n, min(m, n - m)) * combination(n - 1, min(m, n - m - 1)) combination(n, min(m, n - m)) combination n min(m, n - m) min m n - m n m combination(n - 1, min(m, n - m - 1)) combination n - 1 n 1 min(m, n - m - 1) min m n - m - 1 n - m n m 1 s %= MOD s MOD print(s) print s s %= MOD MOD s s = 0 0 s k = map(int, input().split()) map(int, input().split()) k MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD n, k = map(int, input().split()) map(int, input().split()) n s += combination(n, min(m, n - m)) * combination(n - 1, min(m, n - m - 1)) combination(n, min(m, n - m)) * combination(n - 1, min(m, n - m - 1)) s def combination(n, k):
    if k == 0:
        return 1
    else:
        return ((combination(n, k-1) * (n-k+1) % MOD) * pow(k, MOD-2, MOD)) % MOD def combination(n, k):
    if k == 0:
        return 1
    else:
        return ((combination(n, k-1) * (n-k+1) % MOD) * pow(k, MOD-2, MOD)) % MOD combination
import sys
from functools import lru_cache

sys.setrecursionlimit(10 ** 7)

MOD = 10 ** 9 + 7

@lru_cache(None)
def combination(n, k):
    if k == 0:
        return 1
    else:
        return ((combination(n, k-1) * (n-k+1) % MOD) * pow(k, MOD-2, MOD)) % MOD

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

s = 0
for m in range(0, min(k+1, n)):
    s += combination(n, min(m, n - m)) * combination(n - 1, min(m, n - m - 1))
    s %= MOD

print(s)