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


def combinations(n, r, MOD):
    if (r < 0) or (n < r):
        return 0

    r = min(r, n - r)
    return fact[n] * fact_inv[r] * fact_inv[n - r] % MOD


fact = [1, 1]
fact_inv = [1, 1]
inv = [0, 1]

for i in range(2, n + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    fact_inv.append((fact_inv[-1] * inv[-1]) % MOD)


s = 0
for num_zero in range(min(k + 1, n)):
    # nCz
    x = combinations(n, num_zero, MOD)

    # n-zCx
    y = combinations(n - 1, n - num_zero - 1, MOD)

    s += (x * y) % MOD


print(s % MOD) n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k MOD = 1000000007 MOD 1000000007 def combinations(n, r, MOD):
    if (r < 0) or (n < r):
        return 0

    r = min(r, n - r)
    return fact[n] * fact_inv[r] * fact_inv[n - r] % MOD combinations if (r < 0) or (n < r):
        return 0

     (r < 0) or (n < r) r < 0 r 0 n < r n r return 0 0 r = min(r, n - r) r min(r, n - r) min r n - r n r return fact[n] * fact_inv[r] * fact_inv[n - r] % MOD fact[n] * fact_inv[r] * fact_inv[n - r] % MOD fact[n] * fact_inv[r] * fact_inv[n - r] fact[n] * fact_inv[r] fact[n] fact n fact_inv[r] fact_inv r fact_inv[n - r] fact_inv n - r n r MOD n n r r MOD MOD fact = [1, 1] fact [1, 1] 1 1 fact_inv = [1, 1] fact_inv [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, n + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    fact_inv.append((fact_inv[-1] * inv[-1]) % MOD) i range(2, n + 1) range 2 n + 1 n 1 fact.append((fact[-1] * i) % MOD) fact.append fact append (fact[-1] * i) % MOD fact[-1] * i fact[-1] fact -1 i MOD inv.append((-inv[MOD % i] * (MOD // i)) % MOD) inv.append inv append (-inv[MOD % i] * (MOD // i)) % MOD -inv[MOD % i] * (MOD // i) -inv[MOD % i] inv[MOD % i] inv MOD % i MOD i MOD // i MOD i MOD fact_inv.append((fact_inv[-1] * inv[-1]) % MOD) fact_inv.append fact_inv append (fact_inv[-1] * inv[-1]) % MOD fact_inv[-1] * inv[-1] fact_inv[-1] fact_inv -1 inv[-1] inv -1 MOD s = 0 s 0 for num_zero in range(min(k + 1, n)):
    # nCz
    x = combinations(n, num_zero, MOD)

    # n-zCx
    y = combinations(n - 1, n - num_zero - 1, MOD)

    s += (x * y) % MOD num_zero range(min(k + 1, n)) range min(k + 1, n) min k + 1 k 1 n x = combinations(n, num_zero, MOD) x combinations(n, num_zero, MOD) combinations n num_zero MOD y = combinations(n - 1, n - num_zero - 1, MOD) y combinations(n - 1, n - num_zero - 1, MOD) combinations n - 1 n 1 n - num_zero - 1 n - num_zero n num_zero 1 MOD s += (x * y) % MOD s (x * y) % MOD x * y x y MOD print(s % MOD) print s % MOD s MOD def combinations(n, r, MOD):
    if (r < 0) or (n < r):
        return 0

    r = min(r, n - r)
    return fact[n] * fact_inv[r] * fact_inv[n - r] % MOD def combinations(n, r, MOD):
    if (r < 0) or (n < r):
        return 0

    r = min(r, n - r)
    return fact[n] * fact_inv[r] * fact_inv[n - r] % MOD combinations fact_inv = [1, 1] [1, 1] fact_inv s += (x * y) % MOD (x * y) % MOD s k = map(int, input().split()) map(int, input().split()) k fact = [1, 1] [1, 1] fact s = 0 0 s inv = [0, 1] [0, 1] inv y = combinations(n - 1, n - num_zero - 1, MOD) combinations(n - 1, n - num_zero - 1, MOD) y x = combinations(n, num_zero, MOD) combinations(n, num_zero, MOD) x MOD = 1000000007 1000000007 MOD n, k = map(int, input().split()) map(int, input().split()) n
n, k = map(int, input().split())
MOD = 1000000007


def combinations(n, r, MOD):
    if (r < 0) or (n < r):
        return 0

    r = min(r, n - r)
    return fact[n] * fact_inv[r] * fact_inv[n - r] % MOD


fact = [1, 1]
fact_inv = [1, 1]
inv = [0, 1]

for i in range(2, n + 1):
    fact.append((fact[-1] * i) % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    fact_inv.append((fact_inv[-1] * inv[-1]) % MOD)


s = 0
for num_zero in range(min(k + 1, n)):
    # nCz
    x = combinations(n, num_zero, MOD)

    # n-zCx
    y = combinations(n - 1, n - num_zero - 1, MOD)

    s += (x * y) % MOD


print(s % MOD)
