문제 : https://www.acmicpc.net/problem/2805
N, M = map(int, input().split())
heights = list(map(int, input().split()))
l = 1
r = max(heights)
ans = 0
while l <= r:
mid = (l+r)//2
remain = sum(t-mid for t in heights if t-mid > 0)
if remain < M:
r = mid-1
else:
if ans < mid:
ans = mid
l = mid+1
print(ans)