import random
# a start to the aggr problem...
#
# All that's left to implement is the "CHECKS_OUT" routine
# noted below...
#
# get the # of stalls (N) and cows (C)
S = []
for i in range(N):
S += [input()] # get the stalls' locations
S.sort() # sort them
lo = 0
hi = max(S)-min(S)+1
while True:
mid = (lo + hi)/2 # no overflow in Python, right?
if mid == hi or mid == lo: break
# does mid work?
if CHECKS_OUT( mid, C, S ):
lo = mid # worked! look higher (set lo to mid)
else:
hi = mid # did not work... look lower (set hi to mid)
print mid