Forward-Backward algorithm for Hidden Markov models