#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 50;
const long long INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
struct node {
  int l, r;
  int id;
  friend bool operator<(node a, node b) {
    return a.l < b.l;
    if (a.l == b.l) return a.r < b.r;
  }
};
node a[maxn];
priority_queue<int> q;
int ans[maxn][3];
int main(int argc, char *argv[]) {
  if (argc == 2 && strcmp("-debug", argv[1]) == 0) {
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
  }
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].l, &a[i].r);
    a[i].id = i;
  }
  sort(a + 1, a + n + 1);
  int ans = 0, ul = 0, ur = 0;
  for (int i = 1; i <= n; i++) {
    q.push(-a[i].r);
    if (q.size() > k) q.pop();
    if (q.size() == k) {
      int now = -q.top() - a[i].l + 1;
      if (now <= 0) continue;
      if (now > ans) {
        ans = now;
        ul = a[i].l;
        ur = (-q.top());
      }
    }
  }
  cout << ans << endl;
  if (ans == 0) {
    for (int i = 1; i <= k; i++) cout << a[i].id << ' ';
  } else {
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i].l <= ul && a[i].r >= ur) cout << a[i].id << ' ', cnt++;
      if (cnt == k) break;
    }
  }
  return 0;
}
