/*
#include <iostream>
#include <stdio.h>
using namespace std;
bool arr[10];
int input;
void f(int n)
{
if(n+1 == input)
{
int i;
arr[n] = false;
for(i = 0;i <= n;i++)
{
if(arr[i])
{
printf("X");
}
else{
printf("O");
}
}
puts("");
arr[n] = true;
for(i = 0;i <= n;i++)
{
if(arr[i])
{
printf("X");
}
else{
printf("O");
}
}
puts("");
}
else
{
arr[n]=false;
f(n+1);
arr[n]=true;
f(n+1);
}
}
int main()
{
scanf("%d",&input);
f(0);
return 0;
}
*/
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
int arr[100100];
int cows[100100]={0,};
int n,c;
int answer = -100;
int i,j;
int temp;
int back,front;
scanf("%d%d",&n,&c);
for(i = 0;i < n;i++)
{
scanf("%d",&arr[i]);
}
sort(arr,arr+n);/*
for(i=0;i < n;i++)
{
printf("%d ",arr[i]);
}*/
for(i = 0;i < c;i++)
{
cows[i] = i;
}
cows[c-1] = n-1;
for(;;)
{
for(i = c-2;i > 0 ;i--)
{
back = cows[i+1];
front = cows[i-1];
int before;
//before = cows[i];
for(;;)
{
before = cows[i];
cows[i] = (back+front)/2;
//printf("%d %d\n",i,cows[i]);
puts("aaaa");
if(cows[i] == before)
{
if(cows[i-1]!=cows[i]-1)
{
temp =
arr[cows[i]-1] - arr[cows[i-1]]<
arr[cows[i+1]] - arr[cows[i]-1]?
arr[cows[i]-1] - arr[cows[i-1]]:
arr[cows[i+1]] - arr[cows[i]-1];
if(temp >
arr[cows[i]] - arr[cows[i-1]]<
arr[cows[i+1]] - arr[cows[i]]?
arr[cows[i]] - arr[cows[i-1]]:
arr[cows[i+1]] - arr[cows[i]])
{
cows[i]--;
}
}
if(cows[i+1]!=cows[i]+1)
{///인생에 남는 것은 돈도 아니고 명예도 아니고 71억 일겁니다.
temp =
arr[cows[i]+1] - arr[cows[i-1]]<
arr[cows[i+1]] - arr[cows[i]+1]?
arr[cows[i]+1] - arr[cows[i-1]]:
arr[cows[i+1]] - arr[cows[i]+1];
if(temp >
arr[cows[i]] - arr[cows[i-1]]<
arr[cows[i+1]] - arr[cows[i]]?
arr[cows[i]] - arr[cows[i-1]]:
arr[cows[i+1]] - arr[cows[i]])
{
cows[i]++;
}
}
break;
}
if(back == front)
{
if(cows[i-1]!=cows[i]-1)
{
temp =
arr[cows[i]-1] - arr[cows[i-1]]<
arr[cows[i+1]] - arr[cows[i]-1]?
arr[cows[i]-1] - arr[cows[i-1]]:
arr[cows[i+1]] - arr[cows[i]-1];
if(temp >
arr[cows[i]] - arr[cows[i-1]]<
arr[cows[i+1]] - arr[cows[i]]?
arr[cows[i]] - arr[cows[i-1]]:
arr[cows[i+1]] - arr[cows[i]])
{
cows[i]--;
}
}
if(cows[i+1]!=cows[i]+1)
{
temp =
arr[cows[i]+1] - arr[cows[i-1]]<
arr[cows[i+1]] - arr[cows[i]+1]?
arr[cows[i]+1] - arr[cows[i-1]]:
arr[cows[i+1]] - arr[cows[i]+1];
if(temp >
arr[cows[i]] - arr[cows[i-1]]<
arr[cows[i+1]] - arr[cows[i]]?
arr[cows[i]] - arr[cows[i-1]]:
arr[cows[i+1]] - arr[cows[i]])
{
cows[i]++;
}
}
break;
}
if(arr[back] - arr[cows[i]]==arr[cows[i]] - arr[front])
{
break;
}
else if(arr[back] - arr[cows[i]] > arr[cows[i]] - arr[front])
{
front = cows[i];
}
else if(arr[back] - arr[cows[i]]==arr[cows[i]] - arr[front])
{
back = cows[i];
}
}
}
answer = arr[cows[1]] - arr[cows[0]];
//printf("%d!",answer);
for(i = 1;i < c-1;i++)
{
temp =
arr[cows[i]] - arr[cows[i-1]]<
arr[cows[i+1]] - arr[cows[i]]?
arr[cows[i]] - arr[cows[i-1]]:
arr[cows[i+1]] - arr[cows[i]];
/* if(temp==0)
{
printf("asdf");
}
*/
if(temp < answer)
{
//puts("as");
answer = temp;
}
}
if(arr[cows[n-1]]-arr[cows[n-2]]<answer)
{
answer = arr[cows[c-1]]-arr[cows[c-2]];
//printf("?%d?",answer);
}
for(i = 0;i < c;i++)
{
printf("%d ",cows[i]);
}puts(" ");
printf("%d \n",answer);
//puts("as");
}
return 0;
}



