#C11730. Minimum Cloud Storages
Minimum Cloud Storages
Minimum Cloud Storages
You are given ( n ) files and a cloud storage unit with a maximum capacity of ( m ). Each file has a given size. Your task is to determine the minimum number of cloud storages required to back up all the files. A file can be stored only if it fits in the remaining capacity of a storage unit. Files cannot be split between storage units.
Note: It is guaranteed that each file's size does not exceed ( m ).
inputFormat
The input is given via standard input (stdin) and has the following format:
- The first line contains two integers ( n ) and ( m ), representing the number of files and the maximum capacity of each cloud storage respectively.
- The second line contains ( n ) space-separated integers, where each integer represents the size of a file.
outputFormat
Output a single integer to standard output (stdout), which is the minimum number of cloud storages required to store all the files.## sample
5 10
2 3 4 5 6
2