def main():
    import sys
    input = sys.stdin.readline

    # comb init
    mod = 1000000007
    nmax = 4 * 10 ** 5 + 10  # change here
    fac = [0] * nmax
    finv = [0] * nmax
    inv = [0] * nmax
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

    def comb(n, r):
        if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod

    N, K = map(int, input().split())

    ans = 0
    for m in range(min(K+1, N)):
        ans = (ans + (comb(N, m) * comb(N-1, m))%mod)%mod
    print(ans)


if __name__ == '__main__':
    main() def main():
    import sys
    input = sys.stdin.readline

    # comb init
    mod = 1000000007
    nmax = 4 * 10 ** 5 + 10  # change here
    fac = [0] * nmax
    finv = [0] * nmax
    inv = [0] * nmax
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

    def comb(n, r):
        if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod

    N, K = map(int, input().split())

    ans = 0
    for m in range(min(K+1, N)):
        ans = (ans + (comb(N, m) * comb(N-1, m))%mod)%mod
    print(ans) main import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline mod = 1000000007 mod 1000000007 nmax = 4 * 10 ** 5 + 10 nmax 4 * 10 ** 5 + 10 4 * 10 ** 5 4 10 ** 5 10 5 10 fac = [0] * nmax fac [0] * nmax [0] 0 nmax finv = [0] * nmax finv [0] * nmax [0] 0 nmax inv = [0] * nmax inv [0] * nmax [0] 0 nmax fac[0] = 1 fac[0] fac 0 1 fac[1] = 1 fac[1] fac 1 1 finv[0] = 1 finv[0] finv 0 1 finv[1] = 1 finv[1] finv 1 1 inv[1] = 1 inv[1] inv 1 1 for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

     i range(2, nmax) range 2 nmax fac[i] = fac[i - 1] * i % mod fac[i] fac i fac[i - 1] * i % mod fac[i - 1] * i fac[i - 1] fac i - 1 i 1 i mod inv[i] = mod - inv[mod % i] * (mod // i) % mod inv[i] inv i mod - inv[mod % i] * (mod // i) % mod mod inv[mod % i] * (mod // i) % mod inv[mod % i] * (mod // i) inv[mod % i] inv mod % i mod i mod // i mod i mod finv[i] = finv[i - 1] * inv[i] % mod finv[i] finv i finv[i - 1] * inv[i] % mod finv[i - 1] * inv[i] finv[i - 1] finv i - 1 i 1 inv[i] inv i mod def comb(n, r):
        if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod

     comb if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod

     n < r n r return 0 0 return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod fac[n] * ((finv[r] * finv[n - r]) % mod) fac[n] fac n (finv[r] * finv[n - r]) % mod finv[r] * finv[n - r] finv[r] finv r finv[n - r] finv n - r n r mod mod n n r r N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K ans = 0 ans 0 for m in range(min(K+1, N)):
        ans = (ans + (comb(N, m) * comb(N-1, m))%mod)%mod
     m range(min(K+1, N)) range min(K+1, N) min K+1 K 1 N ans = (ans + (comb(N, m) * comb(N-1, m))%mod)%mod ans (ans + (comb(N, m) * comb(N-1, m))%mod)%mod ans + (comb(N, m) * comb(N-1, m))%mod ans (comb(N, m) * comb(N-1, m))%mod comb(N, m) * comb(N-1, m) comb(N, m) comb N m comb(N-1, m) comb N-1 N 1 m mod mod print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    import sys
    input = sys.stdin.readline

    # comb init
    mod = 1000000007
    nmax = 4 * 10 ** 5 + 10  # change here
    fac = [0] * nmax
    finv = [0] * nmax
    inv = [0] * nmax
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

    def comb(n, r):
        if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod

    N, K = map(int, input().split())

    ans = 0
    for m in range(min(K+1, N)):
        ans = (ans + (comb(N, m) * comb(N-1, m))%mod)%mod
    print(ans) def main():
    import sys
    input = sys.stdin.readline

    # comb init
    mod = 1000000007
    nmax = 4 * 10 ** 5 + 10  # change here
    fac = [0] * nmax
    finv = [0] * nmax
    inv = [0] * nmax
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

    def comb(n, r):
        if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod

    N, K = map(int, input().split())

    ans = 0
    for m in range(min(K+1, N)):
        ans = (ans + (comb(N, m) * comb(N-1, m))%mod)%mod
    print(ans) main
def main():
    import sys
    input = sys.stdin.readline

    # comb init
    mod = 1000000007
    nmax = 4 * 10 ** 5 + 10  # change here
    fac = [0] * nmax
    finv = [0] * nmax
    inv = [0] * nmax
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

    def comb(n, r):
        if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod

    N, K = map(int, input().split())

    ans = 0
    for m in range(min(K+1, N)):
        ans = (ans + (comb(N, m) * comb(N-1, m))%mod)%mod
    print(ans)


if __name__ == '__main__':
    main()
