#include<bits/stdc++.h>
using namespace std;
int n,m,a[1000001],mid,ans;
int check(int x)
{
int num=1,last=a[1];
for (int i=2;i<+n;i++)
{
if (a[i]-last>=x)
{
last=a[i];
num++;
}
}
return num;
}
int main()
{
cin>>n>>m;
for (int i=1;i<=n;i++)
cin>>a[i];
sort(a+1,a+n+1);
int l=1,r=1e9;
while(l<=r)
{
mid=(r-l)/2+l;
if (check(mid)>=m)
{
l=mid+1;
ans=mid;
}
else
{
r=mid-1;
}
}
cout<<ans;
return 0;
}