#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<pair<int, int>> c;
vector<int> ci;
vector<int> ansInd;
bool compare(int p1i, int p2i) {
  pair<int, int> p1 = c[p1i];
  pair<int, int> p2 = c[p2i];
  if (p1.first < p2.first)
    return true;
  else if (p1.first == p2.first)
    return p1.second > p2.second;
  else
    return false;
}
bool pcompare(int a, int b) { return (c[a].second > c[b].second); }
int main() {
  cin >> n >> k;
  c = vector<pair<int, int>>(n);
  ci = vector<int>(n);
  ansInd = vector<int>(k);
  int ans = 0;
  for (int x = 0; x < n; x++) {
    cin >> c[x].first >> c[x].second;
    ci[x] = x;
    if (x < k) ansInd[x] = x;
  }
  sort(ci.begin(), ci.end(), compare);
  priority_queue<int, std::vector<int>, function<bool(int, int)>> pq(pcompare);
  if (k == 1) {
    for (int x = 0; x < n; x++) {
      if (c[x].second - c[x].first + 1 > ans) {
        ans = c[x].second - c[x].first + 1;
        ansInd[0] = x;
      }
    }
  } else {
    int bestInd = -1;
    for (int x = 0; x < n - 1; x++) {
      pq.push(ci[x]);
      if (pq.size() > k - 1) pq.pop();
      if (pq.size() == k - 1) {
        int newAns = min(c[pq.top()].second, c[ci[x + 1]].second) -
                     c[ci[x + 1]].first + 1;
        if (newAns > ans) {
          ans = newAns;
          bestInd = x;
        }
      }
    }
    pq = priority_queue<int, std::vector<int>, function<bool(int, int)>>(
        pcompare);
    if (bestInd != -1) {
      for (int x = 0; x <= bestInd; x++) {
        pq.push(ci[x]);
        if (pq.size() > k - 1) pq.pop();
      }
      int index = 1;
      ansInd[0] = ci[bestInd + 1];
      while (pq.size() > 0) {
        ansInd[index] = pq.top();
        pq.pop();
        index++;
      }
    }
    sort(ansInd.begin(), ansInd.end());
  }
  cout << ans << endl;
  cout << ansInd[0] + 1;
  for (int x = 1; x < k; x++) {
    cout << " " << ansInd[x] + 1;
  }
  cout << endl;
}
