#include<iostream>
#include<algorithm>
using namespace std;

const int N=1e5+10;
typedef long long LL;
LL x[N];
LL n,m;

bool check(int d)
{
	int pos=1;
	int cnt=1;
	for(int i=1;i<=n;i++)
	{
		if(x[i]-x[pos]>=d)
		{
			pos=i;
			cnt++;
		}
	}
	return cnt>=m;
}

int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)cin>>x[i];
	sort(x+1,x+n+1);
	
	int l=0,r=x[n]-x[1];
	while(l<r)
	{
		int mid=(l+r+1)/2;
		if(check(mid))
		{
			l=mid;
		}
		else
		{
			r=mid-1;
		}
	}
	
	cout<<l<<endl;
	
	return 0;
}