binary search an element for the first/last meet in an sorted array