
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    mod = 1000000007
    def make_fact(n):
        fact = [1]*(n+1)
        ifact = [1]*(n+1)
        for i in range(1, n+1):
            fact[i] = fact[i-1]*i % mod
        ifact[n] = pow(fact[n], mod-2, mod)
        for i in range(n, 0, -1):
            ifact[i-1] = ifact[i]*i % mod
        return fact, ifact
    fact, ifact = make_fact(n)

    def comb(n, k):
        if k < 0 or k > n: return 0
        return fact[n]*ifact[k]*ifact[n-k] % mod

    ans = 0
    if k > n-1:
        k = n-1
    for i in range(k+1):
        ans = (ans + comb(n, i) * comb(n-1, i))% mod

    print(ans)

main() def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    mod = 1000000007
    def make_fact(n):
        fact = [1]*(n+1)
        ifact = [1]*(n+1)
        for i in range(1, n+1):
            fact[i] = fact[i-1]*i % mod
        ifact[n] = pow(fact[n], mod-2, mod)
        for i in range(n, 0, -1):
            ifact[i-1] = ifact[i]*i % mod
        return fact, ifact
    fact, ifact = make_fact(n)

    def comb(n, k):
        if k < 0 or k > n: return 0
        return fact[n]*ifact[k]*ifact[n-k] % mod

    ans = 0
    if k > n-1:
        k = n-1
    for i in range(k+1):
        ans = (ans + comb(n, i) * comb(n-1, i))% mod

    print(ans) main import sys sys sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k mod = 1000000007 mod 1000000007 def make_fact(n):
        fact = [1]*(n+1)
        ifact = [1]*(n+1)
        for i in range(1, n+1):
            fact[i] = fact[i-1]*i % mod
        ifact[n] = pow(fact[n], mod-2, mod)
        for i in range(n, 0, -1):
            ifact[i-1] = ifact[i]*i % mod
        return fact, ifact
     make_fact fact = [1]*(n+1) fact [1]*(n+1) [1] 1 n+1 n 1 ifact = [1]*(n+1) ifact [1]*(n+1) [1] 1 n+1 n 1 for i in range(1, n+1):
            fact[i] = fact[i-1]*i % mod
         i range(1, n+1) range 1 n+1 n 1 fact[i] = fact[i-1]*i % mod fact[i] fact i fact[i-1]*i % mod fact[i-1]*i fact[i-1] fact i-1 i 1 i mod ifact[n] = pow(fact[n], mod-2, mod) ifact[n] ifact n pow(fact[n], mod-2, mod) pow fact[n] fact n mod-2 mod 2 mod for i in range(n, 0, -1):
            ifact[i-1] = ifact[i]*i % mod
         i range(n, 0, -1) range n 0 -1 ifact[i-1] = ifact[i]*i % mod ifact[i-1] ifact i-1 i 1 ifact[i]*i % mod ifact[i]*i ifact[i] ifact i i mod return fact, ifact return fact, ifact fact ifact n n fact, ifact = make_fact(n) fact make_fact(n) make_fact n ifact def comb(n, k):
        if k < 0 or k > n: return 0
        return fact[n]*ifact[k]*ifact[n-k] % mod

     comb if k < 0 or k > n: return 0
         k < 0 or k > n k < 0 k 0 k > n k n return fact[n]*ifact[k]*ifact[n-k] % mod fact[n]*ifact[k]*ifact[n-k] % mod fact[n]*ifact[k]*ifact[n-k] fact[n]*ifact[k] fact[n] fact n ifact[k] ifact k ifact[n-k] ifact n-k n k mod n n k k ans = 0 ans 0 if k > n-1:
        k = n-1
     k > n-1 k n-1 n 1 k = n-1 k n-1 n 1 for i in range(k+1):
        ans = (ans + comb(n, i) * comb(n-1, i))% mod

     i range(k+1) range k+1 k 1 ans = (ans + comb(n, i) * comb(n-1, i))% mod ans (ans + comb(n, i) * comb(n-1, i))% mod ans + comb(n, i) * comb(n-1, i) ans comb(n, i) * comb(n-1, i) comb(n, i) comb n i comb(n-1, i) comb n-1 n 1 i mod print(ans) print ans main() main def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    mod = 1000000007
    def make_fact(n):
        fact = [1]*(n+1)
        ifact = [1]*(n+1)
        for i in range(1, n+1):
            fact[i] = fact[i-1]*i % mod
        ifact[n] = pow(fact[n], mod-2, mod)
        for i in range(n, 0, -1):
            ifact[i-1] = ifact[i]*i % mod
        return fact, ifact
    fact, ifact = make_fact(n)

    def comb(n, k):
        if k < 0 or k > n: return 0
        return fact[n]*ifact[k]*ifact[n-k] % mod

    ans = 0
    if k > n-1:
        k = n-1
    for i in range(k+1):
        ans = (ans + comb(n, i) * comb(n-1, i))% mod

    print(ans) def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    mod = 1000000007
    def make_fact(n):
        fact = [1]*(n+1)
        ifact = [1]*(n+1)
        for i in range(1, n+1):
            fact[i] = fact[i-1]*i % mod
        ifact[n] = pow(fact[n], mod-2, mod)
        for i in range(n, 0, -1):
            ifact[i-1] = ifact[i]*i % mod
        return fact, ifact
    fact, ifact = make_fact(n)

    def comb(n, k):
        if k < 0 or k > n: return 0
        return fact[n]*ifact[k]*ifact[n-k] % mod

    ans = 0
    if k > n-1:
        k = n-1
    for i in range(k+1):
        ans = (ans + comb(n, i) * comb(n-1, i))% mod

    print(ans) main

def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    mod = 1000000007
    def make_fact(n):
        fact = [1]*(n+1)
        ifact = [1]*(n+1)
        for i in range(1, n+1):
            fact[i] = fact[i-1]*i % mod
        ifact[n] = pow(fact[n], mod-2, mod)
        for i in range(n, 0, -1):
            ifact[i-1] = ifact[i]*i % mod
        return fact, ifact
    fact, ifact = make_fact(n)

    def comb(n, k):
        if k < 0 or k > n: return 0
        return fact[n]*ifact[k]*ifact[n-k] % mod

    ans = 0
    if k > n-1:
        k = n-1
    for i in range(k+1):
        ans = (ans + comb(n, i) * comb(n-1, i))% mod

    print(ans)

main()