Remove elements from the end of the array