get number of k in an ordered array in O(logN)