n, k = map(int, input().split())
k = min(k, n - 1)

MOD = 1000000007

fact = [1] * (n + 1)
ifact = [0] * (n + 1)
for i in range(1, n + 1):
    fact[i] = fact[i - 1] * i % MOD
ifact[n] = pow(fact[n], MOD - 2, MOD)
for i in range(n, 0, -1):
    ifact[i - 1] = ifact[i] * i % MOD

def comb(n, k):
    if k < 0 or k > n:
        return 0
    return fact[n] * ifact[k] * ifact[n - k] % MOD

ans = 0
for i in range(k + 1):
    ans += comb(n, i) * comb(n - 1, i)
    ans %= MOD
print(ans) 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 MOD = 1000000007 MOD 1000000007 fact = [1] * (n + 1) fact [1] * (n + 1) [1] 1 n + 1 n 1 ifact = [0] * (n + 1) ifact [0] * (n + 1) [0] 0 n + 1 n 1 for i in range(1, n + 1):
    fact[i] = fact[i - 1] * i % MOD i range(1, n + 1) range 1 n + 1 n 1 fact[i] = fact[i - 1] * i % MOD fact[i] fact i fact[i - 1] * i % MOD fact[i - 1] * i fact[i - 1] fact i - 1 i 1 i MOD 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 range(n, 0, -1):
    ifact[i - 1] = ifact[i] * i % MOD i range(n, 0, -1) range n 0 -1 ifact[i - 1] = ifact[i] * i % MOD ifact[i - 1] ifact i - 1 i 1 ifact[i] * i % MOD ifact[i] * i ifact[i] ifact i i MOD def comb(n, k):
    if k < 0 or k > n:
        return 0
    return fact[n] * ifact[k] * ifact[n - k] % MOD comb if k < 0 or k > n:
        return 0
     k < 0 or k > n k < 0 k 0 k > n k n return 0 0 return fact[n] * ifact[k] * ifact[n - k] % MOD fact[n] * ifact[k] * ifact[n - k] % MOD fact[n] * ifact[k] * ifact[n - k] fact[n] * ifact[k] fact[n] fact n ifact[k] ifact k ifact[n - k] ifact n - k n k MOD n n k k ans = 0 ans 0 for i in range(k + 1):
    ans += comb(n, i) * comb(n - 1, i)
    ans %= MOD i range(k + 1) range k + 1 k 1 ans += comb(n, i) * comb(n - 1, i) ans comb(n, i) * comb(n - 1, i) comb(n, i) comb n i comb(n - 1, i) comb n - 1 n 1 i ans %= MOD ans MOD print(ans) print ans def comb(n, k):
    if k < 0 or k > n:
        return 0
    return fact[n] * ifact[k] * ifact[n - k] % MOD def comb(n, k):
    if k < 0 or k > n:
        return 0
    return fact[n] * ifact[k] * ifact[n - k] % MOD comb k = min(k, n - 1) min(k, n - 1) k n, k = map(int, input().split()) map(int, input().split()) n ifact = [0] * (n + 1) [0] * (n + 1) ifact MOD = 1000000007 1000000007 MOD k = map(int, input().split()) map(int, input().split()) k ans = 0 0 ans ans %= MOD MOD ans fact = [1] * (n + 1) [1] * (n + 1) fact ans += comb(n, i) * comb(n - 1, i) comb(n, i) * comb(n - 1, i) ans
n, k = map(int, input().split())
k = min(k, n - 1)

MOD = 1000000007

fact = [1] * (n + 1)
ifact = [0] * (n + 1)
for i in range(1, n + 1):
    fact[i] = fact[i - 1] * i % MOD
ifact[n] = pow(fact[n], MOD - 2, MOD)
for i in range(n, 0, -1):
    ifact[i - 1] = ifact[i] * i % MOD

def comb(n, k):
    if k < 0 or k > n:
        return 0
    return fact[n] * ifact[k] * ifact[n - k] % MOD

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