#include <bits/stdc++.h>
namespace patch {
template <typename T>
std::string to_string(const T& n) {
  std::ostringstream stm;
  stm << n;
  return stm.str();
}
}  // namespace patch
using namespace std;
struct st {
  long long int x, y, pos;
};
bool cmp(st a, st b) { return a.x < b.x; }
priority_queue<long long int> s;
st a[300050];
long long int n, k, l, ans;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].y;
    a[i].pos = i;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    if (s.size() < k) {
      s.push(-a[i].y);
    } else if (-s.top() < a[i].y) {
      s.pop(), s.push(-a[i].y);
    }
    if (ans < -s.top() - a[i].x + 1 && s.size() == k) {
      ans = -s.top() - a[i].x + 1, l = a[i].x;
    }
  }
  cout << ans << '\n';
  if (ans == 0) {
    for (int i = 1; i <= k; i++) cout << i << " ";
    return 0;
  }
  for (int i = 1; i <= n && k; i++) {
    if (a[i].x <= l && l + ans - 1 <= a[i].y) {
      cout << a[i].pos << " ";
      k--;
    }
  }
  return 0;
}
