CF1084B.Kvass and the Fair Nut
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are vi liters of kvass in the i -th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by s liters of kvass. But he wants to do it, so kvass level in the least keg is as much as possible.
Help him find out how much kvass can be in the least keg or define it's not possible to pour his glass by s liters of kvass.
输入格式
The first line contains two integers n and s ( 1≤n≤103 , 1≤s≤1012 ) — the number of kegs and glass volume.
The second line contains n integers v1,v2,…,vn ( 1≤vi≤109 ) — the volume of i -th keg.
输出格式
If the Fair Nut cannot pour his glass by s liters of kvass, print −1 . Otherwise, print a single integer — how much kvass in the least keg can be.
输入输出样例
输入#1
3 3 4 3 5
输出#1
3
输入#2
3 4 5 3 4
输出#2
2
输入#3
3 7 1 2 3
输出#3
-1
说明/提示
In the first example, the answer is 3 , the Fair Nut can take 1 liter from the first keg and 2 liters from the third keg. There are 3 liters of kvass in each keg.
In the second example, the answer is 2 , the Fair Nut can take 3 liters from the first keg and 1 liter from the second keg.
In the third example, the Fair Nut can't pour his cup by 7 liters, so the answer is −1 .