Олимпиадный тренинг

Задача 27278. Binary search in ordered array: start (C++)


Задача

Темы:
Implement a binary search algorithm.
 
Input data 
The first line of the input contains natural numbers N and K (\(0<N <= 100000,\ 0<K< ;=10^9\) ). The second line contains the N elements of the array, sorted in ascending order. The elements of the array are integers, each of which does not exceed 109.
 
Output
It is required for  K to output its number in the array on a separate line, if this number occurs in the array, and "NO" otherwise.
 
Examples
# Input Output
1
105
1 2 3 4 5 6 7 8 9 10 
5