#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
struct node {
  int l, r, pos;
  bool operator<(const node &t) const { return l < t.l; }
} a[300006];
priority_queue<int, vector<int>, greater<int> > p;
int L, R, ans;
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].l, &a[i].r);
    a[i].pos = i;
  }
  sort(a + 1, a + 1 + n);
  ans = 0;
  for (int i = 1; i <= n; i++) {
    int len = 0;
    p.push(a[i].r);
    if (p.size() > k) p.pop();
    if (p.size() == k) len = p.top() - a[i].l + 1;
    if (ans < len) {
      ans = len;
      L = a[i].l;
      R = p.top();
    }
  }
  printf("%d\n", ans);
  if (ans == 0)
    for (int i = 1; i <= k; i++) printf("%d ", i);
  else {
    for (int i = 1; i <= n; i++) {
      if (k) {
        if (a[i].l <= L && a[i].r >= R) {
          printf("%d ", a[i].pos);
          k--;
        }
      }
    }
    printf("\n");
  }
  return 0;
}
