/*
qq:1239198605
ctgu_yyf
*/
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;
int x[100005];
int n,m;
bool c(int d)
{
int last = 0;
for(int i=1; i<m; i++)
{
int crt=last+1;
while(crt<n&&x[crt]-x[last]<d)
{
crt++;
}
if(crt==n)
return false;
last=crt;
}
return true;
}
void solve()
{
//对x数组进行排序
sort(x,x+n);
//初始化解的存在范围
int lb=0,rb=x[n-1]-x[0];
while(rb-lb>1)
{
int mid=(lb+rb)/2;
if(c(mid)) lb=mid;
else
rb=mid;
}
cout<<lb<<endl;
}
int main()
{
ios::sync_with_stdio(false);
cin>>n>>m;
for(int i=0;i<n;i++)
cin>>x[i];
solve();
return 0;
}