A dumbwaiter hoist can carry at most C kilograms in a single trip. There are n parcels waiting, each with a whole-number weight. You may load any subset of the parcels as long as their combined weight does not exceed C. Loading nothing gives a total of 0. Report the largest total weight you can load without exceeding the capacity.
Input format
Line 1: two integers n and C.
Line 2: n space-separated integers, the parcel weights.
Output format
A single integer: the maximum achievable total weight that is at most C.
Constraints
- 1 <= n <= 40
- 1 <= each weight <= 1000
- 0 <= C <= 40000