#K39877. Minimum Albums Required
Minimum Albums Required
Minimum Albums Required
You are given an integer representing the number of stamps that Hanako received and an integer representing the capacity of each album. In addition, a list of positive integers is provided, where each integer denotes the size of a stamp. Your task is to determine the minimum number of albums needed to store all the stamps. Each album can hold stamps with a total combined size of at most . This problem can be viewed as a variant of the bin packing problem and can be solved using a greedy strategy.
inputFormat
The input is given via standard input. The first line contains two integers, and , where () is the number of stamps and () is the maximum capacity of each album. The second line contains integers separated by spaces, representing the sizes of the stamps. If is 0, the second line will be empty.
outputFormat
Output a single integer representing the minimum number of albums required to store all the stamps. The result should be printed to standard output.## sample
5 10
2 5 4 7 1
2
</p>