n,k = map(int,input().split()) a = list(map(int,input().split())) ok,ng = 0,10**9+1 while ng-ok>1: m = (ok+ng)//2 p = 0 for i in range(n): if a[i]+p