#include <bits/stdc++.h>
const double PI = acos(-1);
using namespace std;
int n, k;
pair<pair<int, int>, int> z[800100];
pair<int, int> l[500500];
int pre[800100];
vector<int> r2;
multiset<int> st;
int main() {
  cin >> n >> k;
  int j = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &z[j].first.first);
    l[i].first = z[j].first.first;
    z[j].first.second = 0;
    z[j++].second = i;
    scanf("%d", &z[j].first.first);
    z[j].first.second = 1;
    z[j++].second = i;
    l[i].second = z[j - 1].first.first;
  }
  sort(z, z + j);
  int pr = -1;
  int r = 0;
  int mx = 0;
  int in = -1;
  for (int i = 0; i < j; i++) {
    if (z[i].first.second) {
      r--;
    } else {
      r++;
      st.insert(l[z[i].second].second);
      while (st.size() > k) st.erase(st.begin());
      if (r >= k) {
        pr = *st.begin();
        if (mx < pr - z[i].first.first + 1) {
          mx = pr - z[i].first.first + 1;
          in = z[i].first.first;
        }
      }
    }
  }
  if (in == -1) {
    cout << 0 << endl;
    for (int i = 0; i < k; i++) {
      if (i) printf(" ");
      printf("%d", i + 1);
    }
    cout << endl;
  } else {
    cout << mx << endl;
    for (int i = 0; i < n; i++) {
      if (l[i].first <= in && l[i].second >= in + mx - 1) {
        r2.push_back(i);
        if (r2.size() == k) break;
      }
    }
    sort(r2.begin(), r2.end());
    for (int i = 0; i < k; i++) {
      if (i) printf(" ");
      printf("%d", r2[i] + 1);
    }
    cout << endl;
  }
  return 0;
}
