n,k=map(int,input().split())
a=list(map(int,input().split()))
start=1
end=max(a)
while start<=end:
mid=(start+end)//2
s=0
for i in a:
if i>mid:
s+=i-mid
if s>=k:
start=mid+1
elif s<k:
end=mid-1
print(end)
'백준 풀이' 카테고리의 다른 글
백준 14501번 파이썬 (0) | 2022.08.30 |
---|---|
백준 1966번 파이썬 (0) | 2022.08.30 |
백준 14888번 파이썬 dfs (0) | 2022.08.30 |
백준 11724번 파이썬 (dfs) (0) | 2022.08.29 |
백준 2193번 파이썬 (0) | 2022.08.29 |