#include <bits/stdc++.h>
using namespace std;
priority_queue<long long> q;
struct foo {
  long long x, y, pos;
} v[300007];
bool cmt(foo a, foo b) { return a.x < b.x; }
int main() {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  for (int i = 0; i < n; i++) {
    cin >> v[i].x >> v[i].y;
    v[i].pos = i + 1;
  }
  sort(v, v + n, cmt);
  int ans = 0, l;
  for (int i = 0; i < n; i++) {
    if (q.size() < k) {
      q.push(-v[i].y);
    } else if (v[i].y > -q.top()) {
      q.pop();
      q.push(-v[i].y);
    }
    if (ans < -q.top() - v[i].x + 1 && q.size() >= k) {
      ans = -q.top() - v[i].x + 1;
      l = v[i].x;
    }
  }
  cout << ans << endl;
  if (ans == 0) {
    for (int i = 1; i <= k; i++) {
      cout << i << " ";
    }
  } else {
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (v[i].x <= l && v[i].y >= l + ans - 1) {
        cnt++;
        if (cnt > k) break;
        cout << v[i].pos << " ";
      }
    }
  }
}
