#include <bits/stdc++.h>
using namespace std;
long long le[300100], ri[300100];
vector<pair<long long, long long> > seg;
set<long long> out;
int main() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) scanf("%I64d%I64d", &le[i], &ri[i]);
  long long l = 0, r = 2e9 + 10, mid, ans = 0;
  while (l <= r) {
    mid = (l + r) >> 1;
    seg.clear();
    for (long long i = 0; i < n; ++i) {
      if (le[i] <= ri[i] - max(0ll, mid - 1)) {
        seg.push_back({le[i], -i - 1});
        seg.push_back({ri[i] - max(0ll, mid - 1), i});
      }
    }
    sort(seg.begin(), seg.end());
    long long cnt = 0;
    for (long long i = 0; i < seg.size(); ++i) {
      if (seg[i].second >= 0)
        cnt--;
      else {
        cnt++;
        if (cnt == k) break;
      }
    }
    if (cnt == k) {
      l = mid + 1;
      ans = mid;
    } else
      r = mid - 1;
  }
  if (ans == 0) {
    cout << 0 << endl;
    for (long long i = 1; i <= k; ++i) cout << i << ' ';
    return 0;
  }
  long long cnt = 0;
  seg.clear();
  for (long long i = 0; i < n; ++i) {
    if (le[i] <= ri[i] - max(0ll, ans - 1)) {
      seg.push_back({le[i], -i - 1});
      seg.push_back({ri[i] - max(0ll, ans - 1), i});
    }
  }
  sort(seg.begin(), seg.end());
  for (long long i = 0; i < seg.size(); ++i) {
    if (seg[i].second >= 0) {
      cnt--;
      out.erase(seg[i].second);
    } else {
      cnt++;
      out.insert(-seg[i].second - 1);
      if (cnt == k) break;
    }
  }
  cout << ans << endl;
  for (auto i : out) cout << i + 1 << ' ';
  return 0;
}
