Appeal from a judgment of the County Court of St. Lawrence County (Richards, J.), rendered October 10, 2013, convicting defendant upon his plea of guilty of the crime of driving while ability impaired by drugs.
*1108In satisfaction of various charges against him, defendant pleaded guilty in October 2011 to the crime of driving while ability impaired by drugs (see Vehicle and Traffic Law § 1192 [4]). The plea agreement contemplated that defendant would enter, upon acceptance, into the Judicial Diversion Program and that, if he failed to successfully complete the program, he would be sentenced to a prison term of 2V3 to 7 years. In August 2013, after waiving his right to a hearing and admitting that he had absconded from his treatment program in November 2012 and used an illegal drug, he was terminated from the program (see CPL 216.05 [9]). County Court sentenced defendant, as previously agreed to in the Judicial Diversion Program contract, to 2V3 to 7 years in prison.
Defendant contends that his plea was not knowing, intelligent and voluntary because, at the time of his plea, County Court failed to explain a direct consequence of his plea— specifically, the “specified period” of time that he was required to participate in “alcohol or substance abuse treatment” as part of the judicial diversion program (CPL 216.05 [5]; see People v Monk, 21 NY3d 27, 32 [2013]; People v Harnett, 16 NY3d 200, 205-206 [2011]). However, inasmuch as the duration of his treatment regimen was not an “immediate, definite or automatic result” of his guilty plea but, rather, was fashioned by the judicial diversion program outside of County Court’s control in response to defendant’s particular treatment needs and his ongoing response to that treatment, it was a collateral consequence of his plea subject to the preservation requirement (People v Donovan, 94 AD3d 1230, 1231 [2012] [internal quotation marks and citation omitted]; see People v Peque, 22 NY3d 168, 184 [2013], cert denied 574 US —, 135 S Ct 90 [2014]; People v Monk, 21 NY3d at 32; cf. People v Colley, 121 AD3d 523, 524 [2014], lv denied 25 NY3d 1161 [2015]; but cf. People v Louree, 8 NY3d 541, 545-546 [2007]). Here, defendant made no effort before County Court to call into question the voluntariness of his plea or the Judicial Diversion Program contract and said nothing during the plea colloquy that would bring this case within the narrow exception to the preservation requirement (see People v Labaff, 127 AD3d 1471, 1471 [2015], lv denied 26 NY3d 931 [2015]). Notably, defendant did not challenge the voluntariness of his plea until this appeal and after having admitted to failing to comply with the terms of the judicial diversion program (see People v Donovan, 94 AD3d at 1231). Thus, defendant failed to preserve his claim for our review (see People v Peque, 22 NY3d at 182; People v Disotell, 123 AD3d 1230, 1231-1232 [2014], lv denied 25 NY3d 1162 [2015] ).
*1109With regard to defendant’s challenge to his sentence as excessive, County Court properly distinguished the waiver of the right to appeal from the rights that defendant had automatically forfeited by virtue of his guilty plea, ensured that defendant understood the rights that he was waiving and had defendant execute a detailed written waiver in open court that indicated, among other things, that he had an opportunity to discuss the waiver with counsel. Accordingly, we find that the appeal waiver was knowing, voluntary and intelligent (see People v Lopez, 6 NY3d 248, 256 [2006]; People v Jackson, 128 AD3d 1279, 1280 [2015], lv denied 26 NY3d 930 [2015]; People v Guyette, 121 AD3d 1430, 1430-1431 [2014]), and, given the valid waiver of appeal, defendant is precluded from challenging his negotiated sentence as harsh and excessive (see People v Lopez, 6 NY3d at 256).
Garry, Egan Jr., Devine and Clark, JJ., concur.Ordered that the judgment is affirmed.