import sys, math input = lambda: sys.stdin.readline()[:-1] def MI(): return map(int, input().split()) inf = 10**18 n,k = MI() a = list(MI()) def isok(mid): now = 0 cnt = 0 for left in range(n): mn = a[left] + now if mn1: mid = (l+r)//2 if isok(mid): l = mid else: r = mid print(l)