#include<stdio.h>
#include<stdlib.h>
int n, m, i, j;
int sort(const void *a, const void *b)
{
return *(int *)a - *(int *)b;
}
int judge(int *a, int mid)
{
int temp = a[0], count = 1;
for (i = 1; i < n; i++)
{
if (a[i] - temp >= mid)
{
temp = a[i];
count++;
if (count >= m)
return 1;
}
}
return 0;
}
int main()
{
while (scanf("%d%d",&n,&m) != EOF)
{
int a[100000] = {0};
for (i = 0; i < n; i++)
scanf("%d",&a[i]);
qsort(a, n, sizeof(int), sort);
int y = 0;
int l = 0, r = a[n - 1] - a[0];
while (l <= r)
{
int mid = (l + r) / 2;
if (judge(a, mid))
l = mid + 1;
else
r = mid - 1;
}
printf("%d\n",l - 1);
}
return 0;
}