First-order and second-order necessary optimality conditions for discrete-time stochastic systems with delay. (29th April 2022)