#include <bits/stdc++.h>
using namespace std;
int N, K;
int Ans = 0;
int A_i;
int A[301000];
struct Data {
  int x, y, i;
  bool operator()(Data a, Data b) { return a.x < b.x; }
} D[301000];
struct compare {
  bool operator()(Data a, Data b) { return a.y > b.y; }
};
int find_ans(int x, int y) {
  if (y >= x)
    return y - x + 1;
  else
    return 0;
}
int main() {
  scanf("%d%d", &N, &K);
  int i;
  for (i = 0; i < N; i++) {
    scanf("%d%d", &D[i].x, &D[i].y);
    D[i].i = i + 1;
  }
  std::sort(D, D + N, Data());
  priority_queue<Data, vector<Data>, compare> heap;
  for (i = 0; i < K; i++) {
    Data tmp;
    tmp.x = D[i].x;
    tmp.y = D[i].y;
    tmp.i = D[i].i;
    heap.push(tmp);
  }
  Ans = find_ans(D[K - 1].x, heap.top().y);
  A_i = K - 1;
  for (i = K; i < N; i++) {
    if (D[i].y <= heap.top().y) continue;
    heap.pop();
    Data tmp;
    tmp.x = D[i].x;
    tmp.y = D[i].y;
    tmp.i = D[i].i;
    heap.push(tmp);
    if (Ans < find_ans(D[i].x, heap.top().y)) {
      Ans = find_ans(D[i].x, heap.top().y);
      A_i = i;
    }
  }
  for (i = 0; i < K; i++) {
    heap.pop();
  }
  for (i = 0; i < K; i++) {
    Data tmp;
    tmp.x = D[i].x;
    tmp.y = D[i].y;
    tmp.i = D[i].i;
    heap.push(tmp);
  }
  for (i = K; i <= A_i; i++) {
    if (D[i].y <= heap.top().y) continue;
    heap.pop();
    Data tmp;
    tmp.x = D[i].x;
    tmp.y = D[i].y;
    tmp.i = D[i].i;
    heap.push(tmp);
  }
  for (i = 0; i < K; i++) {
    A[i] = heap.top().i;
    heap.pop();
  }
  std::sort(A, A + K);
  printf("%d\n", Ans);
  for (i = 0; i < K; i++) {
    printf("%d ", A[i]);
  }
  return 0;
}
