#include <bits/stdc++.h>
using namespace std;
typedef struct node {
  int x, y, pos;
} node;
priority_queue<int> p;
bool cmp(node a, node b) { return a.x < b.x; }
int main() {
  int n, k, end, i, j;
  scanf("%d%d", &n, &k);
  node A[n + 2];
  int ans = 0;
  for (i = 1; i <= n; ++i) {
    scanf("%d%d", &A[i].x, &A[i].y);
    A[i].pos = i;
  }
  sort(A + 1, A + n + 1, &cmp);
  for (i = 1; i <= n; ++i) {
    if (p.size() < k)
      p.push(-A[i].y);
    else if (-p.top() < A[i].y) {
      p.pop();
      p.push(-A[i].y);
    }
    if (ans < -p.top() - A[i].x + 1 && p.size() == k) {
      ans = -p.top() - A[i].x + 1;
      end = A[i].x;
    }
  }
  printf("%d\n", ans);
  if (ans == 0) {
    for (i = 1; i <= k; ++i) printf("%d ", A[i].pos);
  } else {
    for (i = 1; i <= n; ++i) {
      if (!k) break;
      if (A[i].x <= end && end + ans - 1 <= A[i].y) {
        printf("%d ", A[i].pos);
        k--;
      }
    }
  }
  printf("\n");
  return 0;
}
