def prgm, (array[], target):
    List = []

    for i in array:
        List.append(array[i])  

    List1 = List.set()

    for i in range(len(List)):
        if list[i] == target:
            return target
        elif list1[i] > target:
            return list1[i]
	else:
	    for i in range(len(list)):
		minimum = min(target - list[i], target - list[i+1])

	    for i in range(len(list)):
		if (target - list[i]) == minimum:
		    return list[i]