def find_first_duplicate(nums):
    
    num_set = set()
    no_duplicate = -1
    for i in range(len(nums)):
        if nums[i] in num_set:
            return nums[i]
        else:
            num_set.add(nums[i])
    return no_duplicate
def find_first_duplicate(u66P):
    num_set = set()
    no_duplicate = -1
    for i in range(len(u66P)):
       
        if u66P[i] in num_set:
            return u66P[i]
        else:
            num_set.add(u66P[i])
    return no_duplicate