#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
const int inf = 0x7f7f7f7f;
int n, k;
struct node {
  int l, r;
  int idx;
  bool operator<(const node &n) const { return l < n.l; }
} a[maxn];
int st, ed;
priority_queue<int, vector<int>, greater<int>> qq;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i].l >> a[i].r;
    a[i].idx = i + 1;
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (qq.size() == k - 1) {
      int len = a[i].r - a[i].l + 1;
      if (!qq.empty()) len = min(len, qq.top() - a[i].l + 1);
      if (len > ed - st) {
        st = a[i].l;
        ed = a[i].l + len;
      }
    }
    qq.push(a[i].r);
    while (qq.size() >= k) qq.pop();
  }
  cout << ed - st << endl;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (ans == k) break;
    if ((a[i].l <= st && a[i].r + 1 >= ed) || st == ed) {
      cout << a[i].idx << " ";
      ans++;
    }
  }
  cout << endl;
  return 0;
}
