Appeal by the defendant from a judgment of the Supreme Court, Kings County (D’Emic, J.), rendered July 19, 2012, convicting him of robbery in the third degree and petit larceny, upon his plea of guilty, and imposing sentence.
Ordered that the judgment is affirmed.
The defendant pleaded guilty to robbery in the third degree and petit larceny with the understanding that if he successfully completed a substance-abuse treatment program, he would be permitted to withdraw his plea of guilty to robbery in the third degree, and would be sentenced to a term of probation upon his conviction of petit larceny. However, the Supreme Court explained to the defendant that if he did not complete the program, he would be sentenced to a prison term of 2V2 to 5 years. It is undisputed that the defendant violated the terms of the plea agreement by leaving the treatment program without permission. As a result, the court sentenced the defendant to the enhanced term of 2V2 to 5 years of imprisonment.
The defendant’s purported waiver of his right to appeal was invalid (see People v Bradshaw, 18 NY3d 257, 267 [2011]; People v Lopez, 6 NY3d 248, 256 [2006]). However, contrary to the defendant’s contention, the Supreme Court providently exercised its discretion in declining to afford him a second chance to attend the substance-abuse treatment program after he violated the plea agreement and in imposing the enhanced sentence (see People v Rodriguez, 46 AD3d 356 [2007]; People v Wilson, 11 AD3d 206, 207 [2004]; People v Floyd, 306 AD2d 496 [2003]; see *971also People v Gary, 106 AD3d 932 [2013]; People v Emma, 101 AD3d 1146, 1147 [2012]).
The sentence imposed was not excessive (see People v Suitte, 0 AD2d 80 [1982]). Mastro, J.E, Lott, Austin and Roman, JJ., oncur.