Magnetic Phases of the Random Energy Model