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

mod = 10 ** 9 + 7
N = n + 1

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y // 2) ** 2 % mod
    else            : return power(x, y // 2) ** 2 * x % mod

factorial = [1]
for i in range(1, N):
    factorial.append(factorial[i - 1] * i % mod)

inverseFactorial = [0] * N
inverseFactorial[N - 1] = power(factorial[N - 1], mod - 2)
for i in range(N - 2, -1, -1):
    inverseFactorial[i] = inverseFactorial[i + 1] * (i + 1) % mod

def comb(x, y):
    return factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] % mod

ans = 1
for i in range(1, min(k + 1, n)):
    tmp = comb(n - 1, n - i - 1) * comb(n, i)
    ans += tmp
    ans %= mod
print(ans) n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 N = n + 1 N n + 1 n 1 def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y // 2) ** 2 % mod
    else            : return power(x, y // 2) ** 2 * x % mod power if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y // 2) ** 2 % mod
    else            : return power(x, y // 2) ** 2 * x % mod y == 0 y 0 elif y == 1     : return x % mod
     y == 1 y 1 elif y % 2 == 0 : return power(x, y // 2) ** 2 % mod
     y % 2 == 0 y % 2 y 2 0 x x y y factorial = [1] factorial [1] 1 for i in range(1, N):
    factorial.append(factorial[i - 1] * i % mod) i range(1, N) range 1 N factorial.append(factorial[i - 1] * i % mod) factorial.append factorial append factorial[i - 1] * i % mod factorial[i - 1] * i factorial[i - 1] factorial i - 1 i 1 i mod inverseFactorial = [0] * N inverseFactorial [0] * N [0] 0 N inverseFactorial[N - 1] = power(factorial[N - 1], mod - 2) inverseFactorial[N - 1] inverseFactorial N - 1 N 1 power(factorial[N - 1], mod - 2) power factorial[N - 1] factorial N - 1 N 1 mod - 2 mod 2 for i in range(N - 2, -1, -1):
    inverseFactorial[i] = inverseFactorial[i + 1] * (i + 1) % mod i range(N - 2, -1, -1) range N - 2 N 2 -1 -1 inverseFactorial[i] = inverseFactorial[i + 1] * (i + 1) % mod inverseFactorial[i] inverseFactorial i inverseFactorial[i + 1] * (i + 1) % mod inverseFactorial[i + 1] * (i + 1) inverseFactorial[i + 1] inverseFactorial i + 1 i 1 i + 1 i 1 mod def comb(x, y):
    return factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] % mod comb return factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] % mod factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] % mod factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] factorial[x] * inverseFactorial[y] factorial[x] factorial x inverseFactorial[y] inverseFactorial y inverseFactorial[x - y] inverseFactorial x - y x y mod x x y y ans = 1 ans 1 for i in range(1, min(k + 1, n)):
    tmp = comb(n - 1, n - i - 1) * comb(n, i)
    ans += tmp
    ans %= mod i range(1, min(k + 1, n)) range 1 min(k + 1, n) min k + 1 k 1 n tmp = comb(n - 1, n - i - 1) * comb(n, i) tmp comb(n - 1, n - i - 1) * comb(n, i) comb(n - 1, n - i - 1) comb n - 1 n 1 n - i - 1 n - i n i 1 comb(n, i) comb n i ans += tmp ans tmp ans %= mod ans mod print(ans) print ans tmp = comb(n - 1, n - i - 1) * comb(n, i) comb(n - 1, n - i - 1) * comb(n, i) tmp n, k = map(int, input().split()) map(int, input().split()) n N = n + 1 n + 1 N factorial = [1] [1] factorial def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y // 2) ** 2 % mod
    else            : return power(x, y // 2) ** 2 * x % mod def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y // 2) ** 2 % mod
    else            : return power(x, y // 2) ** 2 * x % mod power mod = 10 ** 9 + 7 10 ** 9 + 7 mod ans %= mod mod ans def comb(x, y):
    return factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] % mod def comb(x, y):
    return factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] % mod comb ans = 1 1 ans ans += tmp tmp ans k = map(int, input().split()) map(int, input().split()) k inverseFactorial = [0] * N [0] * N inverseFactorial
n, k = map(int, input().split())

mod = 10 ** 9 + 7
N = n + 1

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y // 2) ** 2 % mod
    else            : return power(x, y // 2) ** 2 * x % mod

factorial = [1]
for i in range(1, N):
    factorial.append(factorial[i - 1] * i % mod)

inverseFactorial = [0] * N
inverseFactorial[N - 1] = power(factorial[N - 1], mod - 2)
for i in range(N - 2, -1, -1):
    inverseFactorial[i] = inverseFactorial[i + 1] * (i + 1) % mod

def comb(x, y):
    return factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] % mod

ans = 1
for i in range(1, min(k + 1, n)):
    tmp = comb(n - 1, n - i - 1) * comb(n, i)
    ans += tmp
    ans %= mod
print(ans)
