Finding the index of an element from the list