Nearest element to a number in a list

Pls someone tell me how to find the nearest element to a number(x) just less than or equal to that number in a list (ls) in Python 3 efficiently
for example:
x = 17
ls= [10, 8, 5 , 12, 20]

so the output is : 12

Binary Search