You're given a collection of n objects of weights w_1,w_2,…,w_n. You have to pack all n objects into the minimum number of bins under the constraint that the total weight of all the objects in any bin is bounded by S.
The first line contains a pair of integers n and S, where 1≤n≤24 and 1≤S≤108. The second line contains w_1,w_2,…,w_n, where 1≤w_i≤S.
The output is just the minimum number of bins required to pack the given objects.
The objects can be packed into three bins of size 10 as follows: [5,3], [6], [7]. It is impossible to pack them into two bins because their total size is 21.