def main2(nums, k):
    """ Store compliments in a set for lookup.
    Time: O(n)
    Space: O(n)
    """
    prev = set()
    for num in nums:
        if num in prev:
            return True

        compliment = k - num
        prev.add(compliment)

    return False