from collections import defaultdict N, S = map(int, input().split()) A = list(map(int, input().split())) A.sort() l = 0 r = max(A) while r - l > 1: m = (l + r) // 2 ok = True s = S - 1 rem = 0 for a in A: if a <= m: break if rem == 0: s -= a if s < 0: ok = False continue rem = m - 1 else: rem -= 1 if ok: r = m else: l = m print(r)