Ramu help Using binary search

Why first test case not pass and i use binary search algo

debug for this:
5
3
4
5
1
2
2
Correct output:
4
Your output:
-1