#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100005
using namespace std;
int a[N], n, c;
bool judge(int x)
{
int cnt = 1,tmp = a[0];
for(int i = 1; i < n; i++)
{
if(a[i] - tmp >= x)
{
cnt++;
tmp = a[i];
if(cnt >= c)
return true;
}
}
return false;
}
inline int binary_Sreach()
{
int l = 0, r = a[n-1] - a[0];
while(l<=r)
{
int mid = (l + r) / 2;
if(judge(mid))
l = mid + 1;
else
r = mid - 1;
}
return l - 1;
}
int main()
{
while(~scanf("%d %d", &n, &c))
{
for(int i = 0; i<n; i++)
scanf("%d", &a[i]);
sort(a, a+n);
printf("%d\n", binary_Sreach());
}
return 0;
}
#include <cstdio>
#include <algorithm>
#define N 100005
using namespace std;
int a[N], n, c;
bool judge(int x)
{
int cnt = 1,tmp = a[0];
for(int i = 1; i < n; i++)
{
if(a[i] - tmp >= x)
{
cnt++;
tmp = a[i];
if(cnt >= c)
return true;
}
}
return false;
}
inline int binary_Sreach()
{
int l = 0, r = a[n-1] - a[0];
while(l<=r)
{
int mid = (l + r) / 2;
if(judge(mid))
l = mid + 1;
else
r = mid - 1;
}
return l - 1;
}
int main()
{
while(~scanf("%d %d", &n, &c))
{
for(int i = 0; i<n; i++)
scanf("%d", &a[i]);
sort(a, a+n);
printf("%d\n", binary_Sreach());
}
return 0;
}