Optimality Conditions for Discrete-Time Control Problems