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


def pow(x, t):
    if t == 0:
        return 1
    a = pow(x, t >> 1)
    return a * a * (x ** (t & 1)) % MOD


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


def nCr(x, y):
    if y < 0 or y > x:
        return 0
    return fact[x] * ifact[y] * ifact[x - y] % MOD


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


def pow(x, t):
    if t == 0:
        return 1
    a = pow(x, t >> 1)
    return a * a * (x ** (t & 1)) % MOD


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


def nCr(x, y):
    if y < 0 or y > x:
        return 0
    return fact[x] * ifact[y] * ifact[x - y] % MOD


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