What is the intention of the program below?
```
def p1(arr, x):
    def p2(start, end):
        mid = start + (end - start) // 2
        if start == end:
            return -1

        if x == arr[mid]:
            return mid
        elif x < arr[mid]:
            return p2(start, mid)
        else:
            return p2(mid + 1, end)

    return p2(0, len(arr))
```