Optimal controllers of the second kind