//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
ll gcd(ll a, ll b){
if(b == 0) return a;
return gcd(b, a%b);
}
int n, k, arr[100005];
bool possible(int mid){
int last = -MOD, rem = k;
for(int i=1;i<=n;i++){
if(arr[i] <= last) continue;
if(arr[i]-last <= mid) continue;
int j = i;
while(j <= n && (arr[j] - arr[i]) <= mid)
j++;
last = arr[j-1];
rem--;
if(rem < 0) return false;
}
return true;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n>>k;
for(int i=1;i<=n;i++)
cin>>arr[i];
sort(arr+1, arr+n+1);
int ans = MOD, lo = 0, hi = MOD;
while(lo <= hi){
int mid = (lo + hi)/2;
if(possible(mid)){
ans = min(ans, mid);
hi = mid-1;
}
else{
lo = mid+1;
}
}
cout<<ans;
return 0;
}
Ly9zYXR5YWtpMzc5NAojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBmZiBmaXJzdAojZGVmaW5lIHNzIHNlY29uZAojZGVmaW5lIHBiIHB1c2hfYmFjawojZGVmaW5lIE1PRCAoMTAwMDAwMDAwN0xMKQojZGVmaW5lIExFRlQobikgKDIqKG4pKQojZGVmaW5lIFJJR0hUKG4pICgyKihuKSsxKQoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgbGw7CnR5cGVkZWYgdW5zaWduZWQgbG9uZyBsb25nIHVsbDsKdHlwZWRlZiBwYWlyPGludCwgaW50PiBpaTsKCmxsIHB3cihsbCBiYXNlLCBsbCBwLCBsbCBtb2QgPSBNT0QpewpsbCBhbnMgPSAxO3doaWxlKHApe2lmKHAmMSlhbnM9KGFucypiYXNlKSVtb2Q7YmFzZT0oYmFzZSpiYXNlKSVtb2Q7cC89Mjt9cmV0dXJuIGFuczsKfQoKCmxsIGdjZChsbCBhLCBsbCBiKXsKICAgIGlmKGIgPT0gMCkgIHJldHVybiBhOwogICAgcmV0dXJuIGdjZChiLCBhJWIpOwp9CgoKaW50IG4sIGssIGFyclsxMDAwMDVdOwoKYm9vbCBwb3NzaWJsZShpbnQgbWlkKXsKICAgIGludCBsYXN0ID0gLU1PRCwgcmVtID0gazsKICAgIGZvcihpbnQgaT0xO2k8PW47aSsrKXsKICAgICAgICBpZihhcnJbaV0gPD0gbGFzdCkgIGNvbnRpbnVlOwogICAgICAgIGlmKGFycltpXS1sYXN0IDw9IG1pZCkgIGNvbnRpbnVlOwogICAgICAgIGludCBqID0gaTsKICAgICAgICB3aGlsZShqIDw9IG4gJiYgKGFycltqXSAtIGFycltpXSkgPD0gbWlkKQogICAgICAgICAgICBqKys7CiAgICAgICAgbGFzdCA9IGFycltqLTFdOwogICAgICAgIHJlbS0tOwogICAgICAgIGlmKHJlbSA8IDApIHJldHVybiBmYWxzZTsKICAgIH0KICAgIHJldHVybiB0cnVlOwp9CgoKCmludCBtYWluKCl7CgogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTsKICAgIGNpbi50aWUoMCk7CgogICAgY2luPj5uPj5rOwogICAgZm9yKGludCBpPTE7aTw9bjtpKyspCiAgICAgICAgY2luPj5hcnJbaV07CiAgICBzb3J0KGFycisxLCBhcnIrbisxKTsKCiAgICBpbnQgYW5zID0gTU9ELCBsbyA9IDAsIGhpID0gTU9EOwogICAgd2hpbGUobG8gPD0gaGkpewogICAgICAgIGludCBtaWQgPSAobG8gKyBoaSkvMjsKICAgICAgICBpZihwb3NzaWJsZShtaWQpKXsKICAgICAgICAgICAgYW5zID0gbWluKGFucywgbWlkKTsKICAgICAgICAgICAgaGkgPSBtaWQtMTsKICAgICAgICB9CiAgICAgICAgZWxzZXsKICAgICAgICAgICAgbG8gPSBtaWQrMTsKICAgICAgICB9CiAgICB9CgogICAgY291dDw8YW5zOwogICAgcmV0dXJuIDA7Cn0KCgoKCgoKCg==