408847: GYM103348 I Witches Cauldron II

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Witches Cauldron IItime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

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.

Input

The 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$$$.

Output

A 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.

ExamplesInput
4 10
4 8 6 2
Output
2
Input
10 100
36 16 7 33 2 53 25 48 32 11
Output
3

加入题单

算法标签: