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

class Combination:
    def __init__(self, N=10**6, mod=10**9 + 7):
        self.mod = mod
        self.N = N
        self.fact = [1, 1]  # fact[n] = (n! mod p)
        self.factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
        self.inv = [0, 1]  # factinv 計算用
        for i in range(2, N + 1):
            self.fact.append((self.fact[-1] * i) % mod)
            self.inv.append((-self.inv[mod % i] * (mod // i)) % mod)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % mod)

    def nCr(self, n, r):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return self.fact[n] * self.factinv[r] * self.factinv[n-r] % self.mod

comb = Combination(2 * 10**5+100)
ans = 0
mod = 10**9 + 7
for ki in range(min(n+1, k+1)):
    ans = ans % mod + (comb.nCr(n, ki) * comb.nCr(n-1, n-ki-1)) % mod
print(ans%mod)
 n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k class Combination:
    def __init__(self, N=10**6, mod=10**9 + 7):
        self.mod = mod
        self.N = N
        self.fact = [1, 1]  # fact[n] = (n! mod p)
        self.factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
        self.inv = [0, 1]  # factinv 計算用
        for i in range(2, N + 1):
            self.fact.append((self.fact[-1] * i) % mod)
            self.inv.append((-self.inv[mod % i] * (mod // i)) % mod)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % mod)

    def nCr(self, n, r):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return self.fact[n] * self.factinv[r] * self.factinv[n-r] % self.mod Combination def __init__(self, N=10**6, mod=10**9 + 7):
        self.mod = mod
        self.N = N
        self.fact = [1, 1]  # fact[n] = (n! mod p)
        self.factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
        self.inv = [0, 1]  # factinv 計算用
        for i in range(2, N + 1):
            self.fact.append((self.fact[-1] * i) % mod)
            self.inv.append((-self.inv[mod % i] * (mod // i)) % mod)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % mod)

     __init__ self.mod = mod self.mod self mod mod self.N = N self.N self N N self.fact = [1, 1] self.fact self fact [1, 1] 1 1 self.factinv = [1, 1] self.factinv self factinv [1, 1] 1 1 self.inv = [0, 1] self.inv self inv [0, 1] 0 1 for i in range(2, N + 1):
            self.fact.append((self.fact[-1] * i) % mod)
            self.inv.append((-self.inv[mod % i] * (mod // i)) % mod)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % mod)

     i range(2, N + 1) range 2 N + 1 N 1 self.fact.append((self.fact[-1] * i) % mod) self.fact.append self.fact self fact append (self.fact[-1] * i) % mod self.fact[-1] * i self.fact[-1] self.fact self fact -1 i mod self.inv.append((-self.inv[mod % i] * (mod // i)) % mod) self.inv.append self.inv self inv append (-self.inv[mod % i] * (mod // i)) % mod -self.inv[mod % i] * (mod // i) -self.inv[mod % i] self.inv[mod % i] self.inv self inv mod % i mod i mod // i mod i mod self.factinv.append((self.factinv[-1] * self.inv[-1]) % mod) self.factinv.append self.factinv self factinv append (self.factinv[-1] * self.inv[-1]) % mod self.factinv[-1] * self.inv[-1] self.factinv[-1] self.factinv self factinv -1 self.inv[-1] self.inv self inv -1 mod self self N=10**6 N 10**6 10 6 mod=10**9 + 7 mod 10**9 + 7 10**9 10 9 7 def nCr(self, n, r):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return self.fact[n] * self.factinv[r] * self.factinv[n-r] % self.mod nCr 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 self.fact[n] * self.factinv[r] * self.factinv[n-r] % self.mod self.fact[n] * self.factinv[r] * self.factinv[n-r] % self.mod self.fact[n] * self.factinv[r] * self.factinv[n-r] self.fact[n] * self.factinv[r] self.fact[n] self.fact self fact n self.factinv[r] self.factinv self factinv r self.factinv[n-r] self.factinv self factinv n-r n r self.mod self mod self self n n r r comb = Combination(2 * 10**5+100) comb Combination(2 * 10**5+100) Combination 2 * 10**5+100 2 * 10**5 2 10**5 10 5 100 ans = 0 ans 0 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 for ki in range(min(n+1, k+1)):
    ans = ans % mod + (comb.nCr(n, ki) * comb.nCr(n-1, n-ki-1)) % mod ki range(min(n+1, k+1)) range min(n+1, k+1) min n+1 n 1 k+1 k 1 ans = ans % mod + (comb.nCr(n, ki) * comb.nCr(n-1, n-ki-1)) % mod ans ans % mod + (comb.nCr(n, ki) * comb.nCr(n-1, n-ki-1)) % mod ans % mod ans mod (comb.nCr(n, ki) * comb.nCr(n-1, n-ki-1)) % mod comb.nCr(n, ki) * comb.nCr(n-1, n-ki-1) comb.nCr(n, ki) comb.nCr comb nCr n ki comb.nCr(n-1, n-ki-1) comb.nCr comb nCr n-1 n 1 n-ki-1 n-ki n ki 1 mod print(ans%mod) print ans%mod ans mod mod = 10**9 + 7 10**9 + 7 mod class Combination:
    def __init__(self, N=10**6, mod=10**9 + 7):
        self.mod = mod
        self.N = N
        self.fact = [1, 1]  # fact[n] = (n! mod p)
        self.factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
        self.inv = [0, 1]  # factinv 計算用
        for i in range(2, N + 1):
            self.fact.append((self.fact[-1] * i) % mod)
            self.inv.append((-self.inv[mod % i] * (mod // i)) % mod)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % mod)

    def nCr(self, n, r):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return self.fact[n] * self.factinv[r] * self.factinv[n-r] % self.mod class Combination:
    def __init__(self, N=10**6, mod=10**9 + 7):
        self.mod = mod
        self.N = N
        self.fact = [1, 1]  # fact[n] = (n! mod p)
        self.factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
        self.inv = [0, 1]  # factinv 計算用
        for i in range(2, N + 1):
            self.fact.append((self.fact[-1] * i) % mod)
            self.inv.append((-self.inv[mod % i] * (mod // i)) % mod)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % mod)

    def nCr(self, n, r):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return self.fact[n] * self.factinv[r] * self.factinv[n-r] % self.mod Combination ans = 0 0 ans n, k = map(int, input().split()) map(int, input().split()) n comb = Combination(2 * 10**5+100) Combination(2 * 10**5+100) comb ans = ans % mod + (comb.nCr(n, ki) * comb.nCr(n-1, n-ki-1)) % mod ans % mod + (comb.nCr(n, ki) * comb.nCr(n-1, n-ki-1)) % mod ans k = map(int, input().split()) map(int, input().split()) k
n, k = map(int, input().split())

class Combination:
    def __init__(self, N=10**6, mod=10**9 + 7):
        self.mod = mod
        self.N = N
        self.fact = [1, 1]  # fact[n] = (n! mod p)
        self.factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
        self.inv = [0, 1]  # factinv 計算用
        for i in range(2, N + 1):
            self.fact.append((self.fact[-1] * i) % mod)
            self.inv.append((-self.inv[mod % i] * (mod // i)) % mod)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % mod)

    def nCr(self, n, r):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return self.fact[n] * self.factinv[r] * self.factinv[n-r] % self.mod

comb = Combination(2 * 10**5+100)
ans = 0
mod = 10**9 + 7
for ki in range(min(n+1, k+1)):
    ans = ans % mod + (comb.nCr(n, ki) * comb.nCr(n-1, n-ki-1)) % mod
print(ans%mod)

