#include<bits/stdc++.h>
using namespace std;
const int MAX=3e5+7;
int opening[MAX],closing[MAX];
int n,k;
vector<pair<int,int> >v;
vector<pair<int,pair<int,int> > >I;
multiset<int>open,close;
void f()
{
int L=0,R=-1,c=0;
int ans=0,op=0;
for(auto j:v)
{
c++;
I.push_back(make_pair(j.first,make_pair(0,c)));
I.push_back(make_pair(j.second,make_pair(1,c)));
}
sort(I.begin(),I.end());
for(auto j:I)
{
int c=j.second.second;
if(j.second.first==0)
{
op++;
open.insert(j.first);
close.insert(closing[c]);
}
if(op>=k)
{
int r=*close.begin();
int l=*open.rbegin();
if(ans<r-l+1)
{
ans=r-l+1;
L=l;
R=r;
}
}
if(j.second.first==1)
{
op--;
auto k=open.find(opening[c]);
open.erase(k);
k=close.find(j.first);
close.erase(k);
}
}
if(ans==0)
{
cout<<0<<endl;
for(int i=1;i<=k;i++)
cout<<i<<" ";
cout<<endl;
}
else
{
cout<<ans<<endl;
c=0;
for(auto j:v)
{
c++;
if(k<=0)
break;
if(L>=j.first&&R<=j.second)
{
cout<<c<<" ";
k--;
}
}
cout<<endl;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin>>n>>k;
for(int i=1;i<=n;i++)
{
int l,r;
cin>>l>>r;
v.push_back(make_pair(l,r));
opening[i]=l;
closing[i]=r;
}
f();
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBNQVg9M2U1Kzc7CmludCBvcGVuaW5nW01BWF0sY2xvc2luZ1tNQVhdOwppbnQgbixrOwp2ZWN0b3I8cGFpcjxpbnQsaW50PiA+djsKdmVjdG9yPHBhaXI8aW50LHBhaXI8aW50LGludD4gPiA+STsKbXVsdGlzZXQ8aW50Pm9wZW4sY2xvc2U7Cgp2b2lkIGYoKQp7CglpbnQgTD0wLFI9LTEsYz0wOwoJaW50IGFucz0wLG9wPTA7Cglmb3IoYXV0byBqOnYpCgl7CgkJYysrOwoJCUk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