Approach hintTry it first, then revealHide
To reach a target with as few candies as possible, take the sweetest ones first. After sorting in decreasing order the prefix sums increase, so each query is one lower_bound, or -1 if even the total is too small.