Given an array of integers, return the most frequent element. If there is more than one element with maximum frequency, return the one that occurs first in the array. You may assume there is at least one element in the array.