#include <bits/stdc++.h>
using std ::max;
using std ::min;
const int maxx = 300000 + 25;
int n, m, x, y, z, k, num;
int cnt, ans, tot;
int front, back, kr;
int cur[maxx];
std ::priority_queue<int, std ::vector<int>, std ::greater<int> > quq;
class Node {
 public:
  int x;
  int y;
  int id;
};
Node a[maxx];
bool cmp(Node a, Node b) { return a.x == b.x ? a.y < b.y : a.x < b.x; }
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (1), i_END = (n); i <= (i_END); ++i) {
    scanf("%d%d", &a[i].x, &a[i].y);
    a[i].id = i;
  }
  std ::sort(a + 1, a + n + 1, cmp);
  for (int i = (1), i_END = (n); i <= (i_END); ++i) {
    quq.push(a[i].y);
    tot++;
    if (tot > k) {
      quq.pop();
      tot--;
    }
    if (tot == k) {
      if (quq.top() - a[i].x + 1 > ans) {
        ans = quq.top() - a[i].x + 1;
        front = a[i].x;
        back = quq.top();
      }
    }
  }
  printf("%d\n", ans);
  if (ans == 0) {
    for (int i = (1), i_END = (k); i <= (i_END); ++i) printf("%d ", i);
    putchar(10);
    return 0;
  }
  for (int i = (1), i_END = (n); i <= (i_END); ++i) {
    if (front >= a[i].x && a[i].y >= back) {
      printf("%d ", a[i].id);
      kr++;
    }
    if (kr == k) break;
  }
  putchar(10);
  return 0;
}
