def main():
    n, kk = map(int, input().split())

    mod = 10**9+7
    fact = [1, 1]
    for i in range(2, 2*10**5+1):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

    ans = [1]

    for k in range(1, n):
        ans.append(nCr(n-1, k)*nCr(n, k) % mod)

    print(sum(ans[:min(kk+1, n)]) % mod)


main() def main():
    n, kk = map(int, input().split())

    mod = 10**9+7
    fact = [1, 1]
    for i in range(2, 2*10**5+1):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

    ans = [1]

    for k in range(1, n):
        ans.append(nCr(n-1, k)*nCr(n, k) % mod)

    print(sum(ans[:min(kk+1, n)]) % mod) main n, kk = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split kk mod = 10**9+7 mod 10**9+7 10**9 10 9 7 fact = [1, 1] fact [1, 1] 1 1 for i in range(2, 2*10**5+1):
        fact.append(fact[-1]*i % mod)

     i range(2, 2*10**5+1) range 2 2*10**5+1 2*10**5 2 10**5 10 5 1 fact.append(fact[-1]*i % mod) fact.append fact append fact[-1]*i % mod fact[-1]*i fact[-1] fact -1 i mod def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

     nCr return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] pow(fact[n-r]*fact[r] % mod, mod-2, mod) pow fact[n-r]*fact[r] % mod fact[n-r]*fact[r] fact[n-r] fact n-r n r fact[r] fact r mod mod-2 mod 2 mod fact[n] fact n mod n n r r mod=10**9+7 mod 10**9+7 10**9 10 9 7 ans = [1] ans [1] 1 for k in range(1, n):
        ans.append(nCr(n-1, k)*nCr(n, k) % mod)

     k range(1, n) range 1 n ans.append(nCr(n-1, k)*nCr(n, k) % mod) ans.append ans append nCr(n-1, k)*nCr(n, k) % mod nCr(n-1, k)*nCr(n, k) nCr(n-1, k) nCr n-1 n 1 k nCr(n, k) nCr n k mod print(sum(ans[:min(kk+1, n)]) % mod) print sum(ans[:min(kk+1, n)]) % mod sum(ans[:min(kk+1, n)]) sum ans[:min(kk+1, n)] ans :min(kk+1, n) min(kk+1, n) min kk+1 kk 1 n mod main() main def main():
    n, kk = map(int, input().split())

    mod = 10**9+7
    fact = [1, 1]
    for i in range(2, 2*10**5+1):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

    ans = [1]

    for k in range(1, n):
        ans.append(nCr(n-1, k)*nCr(n, k) % mod)

    print(sum(ans[:min(kk+1, n)]) % mod) def main():
    n, kk = map(int, input().split())

    mod = 10**9+7
    fact = [1, 1]
    for i in range(2, 2*10**5+1):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

    ans = [1]

    for k in range(1, n):
        ans.append(nCr(n-1, k)*nCr(n, k) % mod)

    print(sum(ans[:min(kk+1, n)]) % mod) main
def main():
    n, kk = map(int, input().split())

    mod = 10**9+7
    fact = [1, 1]
    for i in range(2, 2*10**5+1):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

    ans = [1]

    for k in range(1, n):
        ans.append(nCr(n-1, k)*nCr(n, k) % mod)

    print(sum(ans[:min(kk+1, n)]) % mod)


main()
