Appeal from a judgment of the Oswego County Court (Walter W. Hafner, Jr., J.), rendered May 28, 2010. The judgment convicted defendant, upon his plea of guilty, of attempted criminal possession of a controlled substance in the third degree (two counts).
It is hereby ordered that the judgment so appealed from is unanimously modified on the law by vacating the surcharge and as modified the judgment is affirmed.
Memorandum: In appeal No. 1, defendant appeals from a judgment convicting him upon his guilty plea of two counts of attempted criminal possession of a controlled substance in the third degree (Penal Law §§ 110.00, 220.16 [1]) and, in appeal No. 2, he appeals from a judgment revoking the sentence of probation imposed upon his previous conviction of criminal possession of a weapon in the third degree (§ 265.02 [1]) and sentencing him to an indeterminate term of incarceration. In both appeals, defendant contends that his waiver of the right to appeal was invalid on the ground that County Court conflated the right to appeal with the rights automatically forfeited upon a plea of guilty. We reject that contention. The record establishes that the court, in the plea colloquy, properly “ ‘describ[ed] the nature of the right being waived without lumping that right into the panoply of trial rights automatically forfeited upon pleading guilty’ ” (People v Tabb, 81 AD3d 1322, 1322 [2011], lv denied 16 NY3d 900 [2011], quoting People v Lopez, 6 NY3d 248, 257 [2006]; see People v Harris, 94 AD3d 1484, 1485 [2012], lv denied 19 NY3d 961 [2012]). Defendant’s waiver of the right to appeal is therefore valid, and that waiver encompasses his challenge to the severity of the sentence in each appeal (see Lopez, 6 NY3d at 256; Harris, 94 AD3d at 1485; see also People v Gordon, 43 AD3d 1330, 1331 [2007], lv denied 9 NY3d 1006 [2007]).
Conversely, with respect to appeal No. 1, “[defendant’s waiver of the right to appeal does not foreclose his [contention] that the restitution portion of the sentence was illegal” (People v Pump, 67 AD3d 1041, 1042 [2009], lv denied 13 NY3d 941 [2010]; see also People v Stachnik, 101 AD3d 1590, 1592 [2012], *1464lv denied 20 NY3d 1104 [2013]) and, based upon “the ‘essential nature’ of the right to be sentenced as provided by law,” we review that contention notwithstanding defendant’s failure to raise it at sentencing (People v Fuller, 57 NY2d 152, 156 [1982]; see People v McCarthy, 83 AD3d 1533, 1534-1535 [2011], lv denied 17 NY3d 819 [2011]). Contrary to defendant’s contention, however, a defendant convicted of, inter alia, a class C “ ‘felony involving the sale of a controlled substance’ may be ordered to repay a law enforcement agency ‘the amount of funds expended in the actual purchase’ of a controlled substance” (People v Diallo, 88 AD3d 1152, 1154 [2011], lv denied 18 NY3d 993 [2012], quoting Penal Law § 60.27 [9]). Section 60.27 (9) was amended in 1991 “to authorize restitution to law enforcement agencies for unrecovered funds utilized to purchase narcotics as part of investigations leading to convictions” (People v Logan, 185 AD2d 994, 995 [1992]). We therefore conclude in appeal No. 1 that the court properly directed defendant to pay restitution to the City of Oswego Police Department for the funds it expended in buying drugs from him.
The People correctly concede with respect to defendant’s further contention in appeal No. 1 that the court erred in imposing a surcharge on that restitution order. Penal Law § 60.27 (9) further provides that “[a]ny restitution which may be required to be made to a law enforcement agency pursuant to this section . . . shall not include a designated surcharge.” We therefore modify the judgment in appeal No. 1 by vacating the surcharge imposed. Present — Smith, J.P., Peradotto, Garni and Lindley, JJ.