A zero-indexed array A consisting of N integers is given. An equilibrium index of this array is any integer P such that 0 <= P < N and the sum of elements of lower indices is equal to the sum of elements of higher indices
Write a function that, given a zero-indexed array A consisting of N integers, returns first of its equilibrium indices. The function should return -1 if no equilibrium index exists.