Please don’t post the same question twice: KKT condition solves the bilevel optimization problem - #7 by abcde.