Given an array of integers and a value, return the distance between the last and first occurrences of the value in the array, or -1 if the value does not exist.