#include <bits/stdc++.h>
using namespace std;
using namespace std;
void enumerateSubmasks(long long m) {
  for (long long s = m;; s = (s - 1) & m) {
    if (s == 0) {
      break;
    }
  }
}
long long answer = 0;
long long bestIndex = 0;
int32_t main() {
  long long n, k;
  cin >> n >> k;
  bestIndex = k - 1;
  vector<pair<pair<long long, long long>, long long>> arr(n);
  for (long long i = 0; i < n; ++i) {
    cin >> arr[i].first.first >> arr[i].first.second;
    arr[i].second = i;
  }
  sort(arr.begin(), arr.end());
  multiset<long long> eP;
  for (long long i = 0; i < k - 1; ++i) {
    eP.insert(arr[i].first.second);
  }
  for (long long i = k - 1; i < n; i++) {
    long long eL = LLONG_MAX;
    if (eP.size() != 0) {
      eL = *eP.begin();
    }
    long long s = arr[i].first.first;
    long long e = min(eL, arr[i].first.second);
    if (answer < (e - s + 1)) {
      bestIndex = i;
      answer = max(answer, e - s + 1);
    }
    if (eP.size() != 0) {
      eP.insert(arr[i].first.second);
      eP.erase(eP.begin());
    }
  }
  cout << answer << endl;
  multiset<pair<long long, long long>> indices;
  for (long long i = 0; i < k - 1; ++i) {
    indices.insert({arr[i].first.second, arr[i].second});
  }
  for (long long j = k - 1; j < bestIndex; j++) {
    indices.insert({arr[j].first.second, arr[j].second});
    indices.erase(indices.begin());
  }
  for (auto node : indices) cout << node.second + 1 << " ";
  cout << arr[bestIndex].second + 1;
}
