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

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