function Find(arrays,target):
    rduplicate = set(arrays)
    difference = abs(target - rduplicate[0])

    for i in range(1, len(rduplicate)):
        d = abs(target - rduplicate[i])
        if d < difference:
            difference = d
            pos = i

    print(rduplicate[i])

find([2, 5, 6, 7, 8, 8, 9], 5)