def getLength(trees, high):
summ = 0
for i in trees:
if high >= i:
continue
else:
summ += (i - high)
return summ
def find(trees, m):
max_h = max(trees)
min_h = 0
while min_h < max_h:
mid_h = (min_h + max_h) // 2
length = getLength(trees, mid_h)
if length <= m:
max_h = mid_h
elif length > m:
min_h = mid_h + 1
return max_h
if __name__ == '__main__':
n, m = map(int, input().split())
trees = [int(x) for x in input().split()]
print(find(trees, m))