408847: GYM103348 I Witches Cauldron II
Description
From Witches Cauldron I:
Double double, toil, and trouble... The Weird Sisters are heating ingredients for a new concoction to mix into a big mixing pot, but their cauldron for heating recently broke! They have a list of essences to throw into a cauldron to heat, but they only have time to heat the cauldron a certain number of times before they need to cast their spell. Each essence needs to be fully in the cauldron (i.e. cannot be split), and all essences are in liquid form.
New:
... fire burn and cauldron bubble. The Witches, with your help, have purchased a cauldron. However, they come to the sudden realization that they actually do not need to heat the essences in a specific order, since they are putting them all into the mixing pot at the end anyway!
With this new information, the Weird Sisters would like you to help them figure out how many times they need to heat the cauldron given that they can heat the essences in any order.
InputThe first line contains two integers, $$$1 \leq n \leq 20$$$ and $$$1 \leq k \leq 10^9$$$, the number of essences and the size of the cauldron respectively.
The next line contains $$$n$$$ integers, the volumes of each essence $$$1 \leq a_i \leq k$$$.
OutputA single integer representing the minimum number of times the cauldron needs to be heated to mix all the essences after ordering in an optimal way.
ExamplesInput4 10 4 8 6 2Output
2Input
10 100 36 16 7 33 2 53 25 48 32 11Output
3