#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 300000;
typedef struct C {
  int l, r, idx;
} C;
bool operator<(const C &a, const C &b) { return a.l < b.l; }
int n, want;
C c[MAXN];
priority_queue<pair<int, int> > q;
int res[MAXN], nres;
void run() {
  scanf("%d%d", &n, &want);
  for (int i = (0); i < (n); ++i) scanf("%d%d", &c[i].l, &c[i].r), c[i].idx = i;
  sort(c, c + n);
  long long ret = 0;
  for (int x = (0); x < (2); ++x) {
    if (x == 1 && ret == 0) {
      nres = 0;
      for (int i = (0); i < (want); ++i) res[nres++] = c[i].idx;
      continue;
    }
    q = priority_queue<pair<int, int> >();
    for (int i = (0); i < (n); ++i) {
      while (((int)(q).size()) > 0 && -q.top().first < c[i].l) q.pop();
      q.push(make_pair(-c[i].r, i));
      while (((int)(q).size()) > want) q.pop();
      if (((int)(q).size()) == want) {
        int cur = -q.top().first - c[i].l + 1;
        if (x == 0 && cur > ret) ret = cur;
        if (x == 1 && cur == ret) {
          nres = 0;
          while (((int)(q).size()) > 0)
            res[nres++] = c[q.top().second].idx, q.pop();
          break;
        }
      }
    }
  }
  sort(res, res + nres);
  printf("%lld\n", ret);
  for (int i = (0); i < (nres); ++i) {
    if (i != 0) printf(" ");
    printf("%d", res[i] + 1);
  }
  puts("");
}
int main() {
  run();
  return 0;
}
