#include<bits/stdc++.h>
using namespace std;intmain(){int S, L, p[1000000];while(1){scanf("%d%d",&L,&S);if(L + S ==0)break;for(int i =0; i < L; i++){scanf("%d",&p[i]);}sort(p, p + L);int left =0, right =1e6, mid;while(left <= right){
mid =(left + right)/2;int count =1, pos =0;for(int i =1; i < L; i++){if(p[i]- p[pos]>= mid){
pos = i;
count++;}}if(count >= S)
left = mid +1;else
right = mid -1;}printf("%d\n", left -1);}return0;}