Large deviations conditioned on large deviations I: Markov chain and Langevin equation