Add an element to the head of the queue, replacing the element at the tail if maxSize has been reached.