program CHANBO;
const fi='chanbo.inp';
      fo='chanbo.out';
      maxn=100005;
var   f:text;
      a:array [1..maxn] of int64;
      n,c:longint;
      res:int64;
      ok:boolean;
procedure nhap;
var  i:longint;
begin
    assign(f,fi);
    reset(f);
    readln(f,n,c);
    for i:=1 to n do
        readln(f,a[i]);
    close(f);
end;
procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do inc(i);
           while x<a[j] do dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then sort(l,j);
         if i<r then sort(i,r);
end;
procedure tinh(x:longint);
var h,k:longint;
        tmp,dem:longint;
begin
        ok:=false;
        tmp:=1;
        h:=1;k:=2;
        dem:=1;
        while (tmp < c) and ( dem <> n ) do
           begin
                if a[k]-a[h] >= x then
                     begin
                        inc(tmp);
                        h:=k;
                        inc(k);
                     end
                else inc(k);
                inc(dem);
           end;
        if tmp=c then ok:=true;
end;
procedure chat;
var   l,r,mid:int64;
begin
    l:=a[1];
    r:=a[n];
    while l<=r do
        begin
            mid:=(l+r) div 2 ;
            tinh(mid);
            if ok  then
              begin
                l:=mid+1;
                res:=mid;
              end
                else r:=mid-1;
        end;
end;
procedure xuat;
begin
    assign(f,fo);
    rewrite(f);
    write(f,res);
    close(f);
end;
begin
     nhap;
     sort(1,n);
     chat;
     xuat;
end.
