#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return x * f;
}
int n, k;
int len, l, r;
struct node {
  int l, r, id;
} a[300500];
inline bool cmp(node a, node b) { return a.l < b.l; }
priority_queue<int> q;
int main() {
  n = read();
  k = read();
  for (int i = 1; i <= n; i++) {
    a[i].l = read();
    a[i].r = read();
    a[i].id = i;
  }
  sort(a + 1, a + n + 1, cmp);
  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 > len) {
        len = now;
        l = a[i].l;
        r = (-q.top());
      }
    }
  }
  printf("%d\n", len);
  if (!len)
    for (int i = 1; i <= k; i++) printf("%d ", i);
  else
    for (int i = 1, j = 1; i <= n && j <= k; i++)
      if (a[i].l <= l && a[i].r >= r) printf("%d ", a[i].id), j++;
  return 0;
}
