#C11121. Minimum Van Trips

    ID: 40403 Type: Default 1000ms 256MiB

Minimum Van Trips

Minimum Van Trips

You are given a set of parcels with their respective weights and a van with a maximum weight capacity \(C\). Your task is to determine the minimum number of trips required to transport all parcels. On each trip, you can load a subset of parcels as long as their total weight does not exceed the van's capacity.

Input Constraints:

  • The number of parcels \(n\) is relatively small (e.g. \(n \le 15\)).
  • Each parcel's weight and the capacity \(C\) are positive integers.

All input should be read from standard input and the result should be printed to standard output.

inputFormat

The first line contains two integers, \(n\) (the number of parcels) and \(C\) (the maximum capacity of the van).

The second line contains \(n\) space-separated integers representing the weights of the parcels.

outputFormat

Output a single integer representing the minimum number of trips needed to transport all parcels.

## sample
5 10
2 3 4 5 9
3

</p>