Search for exotic decays of the Higgs boson using photons with the Compact Muon Solenoid experiment