Spectrum of modular Hamiltonian in the vacuum and excited states