Packing - MarisaOJ: Marisa Online Judge

Packing

Time limit: 1000 ms
Memory limit: 256 MB
Marisa got $n$ unused items, and she decided to put them in some boxes. The $i^{th}$ item weighs $w_i$. Knowing each box can withstand a weight of $W$, what's the minimum number of boxes does she need to use? ### Input - The first line contains 2 integers $n, W$. - The second line contains $n$ integers $w_i$. ### Output - Print the minimum number of boxes she need. ### Constraints - $1 \le n \le 20$. - $1 \le A_i \le W \le 10^9$. ### Example Input: ``` 4 5 1 2 3 4 ``` Output: ``` 2 ```