Jake wishes that he wasn't so hungry and gets a sandwich.
Jake asks Finn to wish for the Ancient Psychic Tandem War Elephant so he does.
The elephant then wishes for Jake's life to be saves as Finn wishes it to.
Jake is so hungry that he wishes he wasn't so hungry and gets a sandwich, and Finn is torn between wishing for the elephant or to save Jake. Jake tells him to wish for the elephant and so ultimately Finn wishes for the ancient psychic tandem war elephant which wishes for his friends to be saved and they all ride out on it.