#!/usr/bin/env python3
import sys
from itertools import count, islice

MOD = 1000000007  # type: int

def mod_factorial_iter():
    acc = 1
    yield 1
    for i in count(1):
        acc = acc * i % MOD
        yield acc

def solve(n: int, k: int):
    mod_factorials = tuple(islice(mod_factorial_iter(), n+2))
    def comb(a, b):
        return (mod_factorials[a] * (pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD)) % MOD) % MOD
    ans = 1
    for i in range(1, min(n-1, k)+1):
        t = (comb(n-1, i) * comb(n, i)) % MOD
        ans = (ans + t) % MOD
    return ans


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    print(solve(n, k))

if __name__ == '__main__':
    main()
    
             import sys sys from itertools import count, islice MOD = 1000000007 MOD 1000000007 def mod_factorial_iter():
    acc = 1
    yield 1
    for i in count(1):
        acc = acc * i % MOD
        yield acc mod_factorial_iter acc = 1 acc 1 yield 1 1 for i in count(1):
        acc = acc * i % MOD
        yield acc i count(1) count 1 acc = acc * i % MOD acc acc * i % MOD acc * i acc i MOD yield acc acc def solve(n: int, k: int):
    mod_factorials = tuple(islice(mod_factorial_iter(), n+2))
    def comb(a, b):
        return (mod_factorials[a] * (pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD)) % MOD) % MOD
    ans = 1
    for i in range(1, min(n-1, k)+1):
        t = (comb(n-1, i) * comb(n, i)) % MOD
        ans = (ans + t) % MOD
    return ans


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template) solve mod_factorials = tuple(islice(mod_factorial_iter(), n+2)) mod_factorials tuple(islice(mod_factorial_iter(), n+2)) tuple islice(mod_factorial_iter(), n+2) islice mod_factorial_iter() mod_factorial_iter n+2 n 2 def comb(a, b):
        return (mod_factorials[a] * (pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD)) % MOD) % MOD
     comb return (mod_factorials[a] * (pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD)) % MOD) % MOD (mod_factorials[a] * (pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD)) % MOD) % MOD mod_factorials[a] * (pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD)) % MOD mod_factorials[a] * (pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD)) mod_factorials[a] mod_factorials a pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD) pow(mod_factorials[a-b], MOD-2, MOD) pow mod_factorials[a-b] mod_factorials a-b a b MOD-2 MOD 2 MOD pow(mod_factorials[b], MOD-2, MOD) pow mod_factorials[b] mod_factorials b MOD-2 MOD 2 MOD MOD MOD a a b b ans = 1 ans 1 for i in range(1, min(n-1, k)+1):
        t = (comb(n-1, i) * comb(n, i)) % MOD
        ans = (ans + t) % MOD
     i range(1, min(n-1, k)+1) range 1 min(n-1, k)+1 min(n-1, k) min n-1 n 1 k 1 t = (comb(n-1, i) * comb(n, i)) % MOD t (comb(n-1, i) * comb(n, i)) % MOD comb(n-1, i) * comb(n, i) comb(n-1, i) comb n-1 n 1 i comb(n, i) comb n i MOD ans = (ans + t) % MOD ans (ans + t) % MOD ans + t ans t MOD return ans ans n: int n k: int k def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    print(solve(n, k)) main def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
     iterate_tokens for line in sys.stdin:
            for word in line.split():
                yield word
     line sys.stdin sys stdin for word in line.split():
                yield word
     word line.split() line.split line split yield word word tokens = iterate_tokens() tokens iterate_tokens() iterate_tokens n = int(next(tokens)) n int(next(tokens)) int next(tokens) next tokens k = int(next(tokens)) k int(next(tokens)) int next(tokens) next tokens print(solve(n, k)) print solve(n, k) solve n k if __name__ == '__main__':
    main()
    
             __name__ == '__main__' __name__ '__main__' main() main def solve(n: int, k: int):
    mod_factorials = tuple(islice(mod_factorial_iter(), n+2))
    def comb(a, b):
        return (mod_factorials[a] * (pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD)) % MOD) % MOD
    ans = 1
    for i in range(1, min(n-1, k)+1):
        t = (comb(n-1, i) * comb(n, i)) % MOD
        ans = (ans + t) % MOD
    return ans


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template) def solve(n: int, k: int):
    mod_factorials = tuple(islice(mod_factorial_iter(), n+2))
    def comb(a, b):
        return (mod_factorials[a] * (pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD)) % MOD) % MOD
    ans = 1
    for i in range(1, min(n-1, k)+1):
        t = (comb(n-1, i) * comb(n, i)) % MOD
        ans = (ans + t) % MOD
    return ans


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template) solve def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    print(solve(n, k)) def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    print(solve(n, k)) main def mod_factorial_iter():
    acc = 1
    yield 1
    for i in count(1):
        acc = acc * i % MOD
        yield acc def mod_factorial_iter():
    acc = 1
    yield 1
    for i in count(1):
        acc = acc * i % MOD
        yield acc mod_factorial_iter MOD = 1000000007 1000000007 MOD
#!/usr/bin/env python3
import sys
from itertools import count, islice

MOD = 1000000007  # type: int

def mod_factorial_iter():
    acc = 1
    yield 1
    for i in count(1):
        acc = acc * i % MOD
        yield acc

def solve(n: int, k: int):
    mod_factorials = tuple(islice(mod_factorial_iter(), n+2))
    def comb(a, b):
        return (mod_factorials[a] * (pow(mod_factorials[a-b], MOD-2, MOD) * pow(mod_factorials[b], MOD-2, MOD)) % MOD) % MOD
    ans = 1
    for i in range(1, min(n-1, k)+1):
        t = (comb(n-1, i) * comb(n, i)) % MOD
        ans = (ans + t) % MOD
    return ans


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    print(solve(n, k))

if __name__ == '__main__':
    main()
    
            
