In any prosecution for an offense, it is an affirmative defense that when the defendant engaged in the proscribed conduct, he lacked criminal responsibility by reason of mental disease or defect. Such lack of criminal responsibility means that at the time of such conduct, as a result of mental disease or defect, he lacked substantial capacity to know or appreciate either:
N.Y. Penal Law § 40.15