Generate a Python program that has the following intention:

The intention of the program is to find the index of the first occurrence of a given value x in the sorted array arr. The program uses a recursive function p2 to perform a binary search on the array to find the index of x. The main function p1 takes the array and the value of x as input and calls the p2 function to perform the binary search. The function returns the index of the first occurrence of x in the array, or -1 if x is not present in the array. Provide your response in exactly 3 paragraphs (separated nearby paragraphs with 3 aterisk symbols ***).
user