I\'m trying to return the index of the element to be searched. All the elements are being detected except the first element. What\'s wrong? Why is the function not returning