M-Best-Diverse Labelings for Submodular Energies and Beyond