4164: 超级书架

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:17 Solved:9

Description

Farmer John最近为奶牛们的图书馆添置了一个巨大的书架,尽管它是如此的大,但它还是几乎瞬间就被各种各样的书塞满了。现在,只有书架的顶上还留有一点空间。

所有lns="http://www.w3.org/1998/Math/MathML">(lns="http://www.w3.org/1998/Math/MathML">120)头奶牛都有一个确定的身高lns="http://www.w3.org/1998/Math/MathML">lns="http://www.w3.org/1998/Math/MathML">(lns="http://www.w3.org/1998/Math/MathML">1 lns="http://www.w3.org/1998/Math/MathML"> lns="http://www.w3.org/1998/Math/MathML">lns="http://www.w3.org/1998/Math/MathML"> lns="http://www.w3.org/1998/Math/MathML"> lns="http://www.w3.org/1998/Math/MathML">1,000,000)。设所有奶牛身高的和为lns="http://www.w3.org/1998/Math/MathML">。书架的高度为lns="http://www.w3.org/1998/Math/MathML">,数据保证lns="http://www.w3.org/1998/Math/MathML">1

为了够到比最高的那头奶牛还要高的书架顶,奶牛们不得不象演杂技一般,一头站在另一头的背上,叠成一座"奶牛塔"。当然,这个塔的高度,就是塔中所有奶牛的身高之和。为了往书架顶上放东西,所有奶牛的身高和必须不小于书架的高度。

塔叠得越高便越不稳定,于是奶牛们希望找到一种方案,使得叠出的塔在高度不小于书架高度的情况下,高度尽可能小。你也可以猜到你的任务了:写一个程序,计算奶牛们叠成的塔在满足要求的情况下,最少要比书架高多少。

Input

lns="http://www.w3.org/1998/Math/MathML">1行: lns="http://www.w3.org/1998/Math/MathML">2个用空格隔开的整数:lns="http://www.w3.org/1998/Math/MathML"> 和 lns="http://www.w3.org/1998/Math/MathML">

lns="http://www.w3.org/1998/Math/MathML">2..lns="http://www.w3.org/1998/Math/MathML">+1行: 第lns="http://www.w3.org/1998/Math/MathML">+1行是lns="http://www.w3.org/1998/Math/MathML">1个整数:lns="http://www.w3.org/1998/Math/MathML">lns="http://www.w3.org/1998/Math/MathML">

Output

输出1个整数,代表奶牛们叠成的塔在满足要求的情况下,最少要比书架高多少。

Sample Input Copy

5 16
3
1
3
5
6

Sample Output Copy

1