#include <bits/stdc++.h>
using namespace std;
struct Event {
  int L, R, num;
};
Event E[300007];
set<pair<int, int> > s;
long long N, K, best, bestL, bestR, res, answer;
bool cmp(Event e1, Event e2) {
  if (e1.L == e2.L) return e1.R < e2.R;
  return e1.L < e2.L;
}
void readData() {
  scanf("%ld %ld", &N, &K);
  for (int i = 0; i < N; i++) {
    scanf("%d %d", &E[i].L, &E[i].R);
    E[i].num = i;
  }
}
void printset() {
  for (auto t = s.begin(); t != s.end(); t++) {
    cout << "(" << t->first << ' ' << t->second << ") ";
  }
  cout << endl;
}
int solve() {
  long long c;
  s.clear();
  best = 0;
  c = 0;
  for (int i = 0; i < N; i++) {
    s.insert(make_pair(E[i].R, E[i].num));
    if (s.size() > K) {
      s.erase(s.begin());
    }
    if (s.size() == K) {
      res = s.begin()->first - E[i].L + 1;
      if (res > best) {
        best = res;
        if (answer != -1 && best == answer) {
          for (auto t = s.begin(); t != s.end(); t++) {
            printf("%d ", t->second + 1);
          }
          printf("\n");
          return answer;
        }
      }
    }
  }
  return best;
}
int main() {
  readData();
  sort(E, E + N, cmp);
  answer = -1;
  answer = solve();
  cout << answer << endl;
  if (answer == 0) {
    for (int i = 1; i <= K; i++) printf("%d ", i);
    printf("\n");
  } else
    solve();
  return 0;
}
