The exact score for time series models in state space form