1183: 砍树

Memory Limit:128 MB Time Limit:1.000 S Judge Style:Text Compare Creator:
Submit:153 Solved:29

Description

伐木工人 Mirko 需要砍 lns="http://www.w3.org/1998/Math/MathML"> 米长的木材。对 Mirko 来说这是很简单的工作,因为他有一个漂亮的新伐木机,可以如野火一般砍伐森林。不过,Mirko 只被允许砍伐一排树。

Mirko 的伐木机工作流程如下:Mirko 设置一个高度参数 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"> 米的部分保持不变)。Mirko 就得到树木被锯下的部分。例如,如果一排树的高度分别为 lns="http://www.w3.org/1998/Math/MathML">20,15,10 和 lns="http://www.w3.org/1998/Math/MathML">17,Mirko 把锯片升到 lns="http://www.w3.org/1998/Math/MathML">15 米的高度,切割后树木剩下的高度将是 lns="http://www.w3.org/1998/Math/MathML">15,15,10 和 lns="http://www.w3.org/1998/Math/MathML">15,而 Mirko 将从第 lns="http://www.w3.org/1998/Math/MathML">1 棵树得到 lns="http://www.w3.org/1998/Math/MathML">5 米,从第 lns="http://www.w3.org/1998/Math/MathML">4 棵树得到 lns="http://www.w3.org/1998/Math/MathML">2 米,共得到 lns="http://www.w3.org/1998/Math/MathML">7 米木材。

Mirko 非常关注生态保护,所以他不会砍掉过多的木材。这也是他尽可能高地设定伐木机锯片的原因。请帮助 Mirko 找到伐木机锯片的最大的整数高度 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"> 米木材。

不允许普通用户打印题目,请教师登录后使用。如有疑问请联系管理员!

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"> 表示树木的数量,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"> 个整数表示每棵树的高度。

0<M<1e9

0<N<1e6

Output

 个整数,表示锯片的最高高度。

Sample Input Copy

4 7
20 15 10 17

Sample Output Copy

15

HINT

样例输入2

5 20
4 42 40 26 46


样例输出2

36