Asymptotic normality of M-estimators in nonhomogeneous hidden Markov models