#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int i;
  vector<pair<int, int>> arr(n), huy;
  for (i = 0; i < n; ++i) {
    cin >> arr[i].first >> arr[i].second;
  }
  huy = arr;
  sort(arr.begin(), arr.end());
  int result = 0, f, l;
  priority_queue<int, vector<int>, greater<int>> que;
  for (i = 0; i < n; ++i) {
    que.push(arr[i].second);
    if (que.size() > k) que.pop();
    if (que.size() == k && result < que.top() - arr[i].first + 1) {
      result = que.top() - arr[i].first + 1;
      f = arr[i].first;
      l = que.top();
    }
  }
  cout << result << endl;
  if (result == 0) {
    for (i = 0; i < k; ++i) {
      cout << i + 1 << ' ';
    }
    return 0;
  }
  int m = 0;
  for (i = 0; i < n; ++i) {
    if (huy[i].first <= f && huy[i].second >= l && m < k) {
      cout << i + 1 << ' ';
      ++m;
    }
  }
  return 0;
}
