def _binary_search(array, elt):
    """Modified binary search on an array."""
    start = 0
    end = len(array) - 1

    while start <= end:
        mid = (start + end) // 2
        if elt == array[mid]:
            return mid + 1
        if elt < array[mid]:
            end = mid - 1
        else:
            start = mid + 1

    if start > end:
        return start