Searching an Array


Your friend has a sorted array of nn integers, and he wants you to find whether it contains a number kk. You can make a maximum of log2(n)\lceil \log_2(n) \rceil queries of the following form:

  • What is the number at the xx-th position? (1 indexed).

Interaction

The first line of input contains two integers, nn and kk.

To query the number at the xx-th position, print a line containing only xx and the judge will respond with the number (1018)(\le 10^{18}) at that position, which you can read as a line of input.

To give a final answer, print "YES" or "NO", answering whether the integer exists in the array.

Constraints

  • 1n1091 \le n \le 10^9
  • 1k10181 \le k \le 10^{18}

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.