n, c = map(int, input().split())
houses = [int(input()) for _ in range(n)] 
houses.sort() # 이진 탐색을 위한 정렬

# mid를 최소 거리로 할 때, 설치할 수 있는 공유기의 개수를 구함
# 만약 더 설치할 수 있다면, 거리를 계속해서 늘린다.
# 설치할 수 없다면, 거리를 계속해서 줄인다.
def can_Install(mid):
    count = 1
    last = houses[0]
    
    for house in houses:
        if house - last >= mid:
            count +=1
            last = house
    
    return count >= c
    
left = 1 # 최소 거리
right = houses[n-1] - houses[0] # 최대 거리

while left <= right:
    mid = (left+right) // 2
    
    if can_Install(mid):
        left = mid + 1
    else:
        right = mid - 1
        
    
print(right)