import sys
def verify(arr, n, c, diff):
count = c
i = 0
j = n-1
hsh = {i:True for i in arr}
if arr[j] - arr[i] >= diff:
hsh[arr[i]] = False
hsh[arr[j]] = False
count -= 2
required = arr[i] + diff
while i < j:
while arr[i] < required:
i += 1
if hsh[arr[i]] == False and count > 0:
break
if abs(arr[i] - arr[j]) < diff and count > 0:
break
hsh[arr[i]] = False
count -= 1
if count == 0:
return True
required = arr[i] + diff
return False
def driver(arr, n, c):
hi = arr[n-1]
lo = 1
op = 1
while lo < hi:
mid = int((lo + hi)/2)
poss = verify(arr, n, c, mid)
if poss:
lo = mid + 1
if mid > op:
op = mid
else:
hi = mid
return op
n, c = list(map(int, input().split()))
pos = []
for i in range(n):
pos.append(int(input()))
pos.sort()
print driver(pos, n, c)