#include <bits/stdc++.h>
using namespace std;
const int MAX = 3E5 + 10;
struct Node {
  int index, first, second;
  bool operator<(const Node &tmp) const { return first < tmp.first; }
};
int N, K;
Node a[MAX];
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; ++i) {
    scanf("%d %d", &a[i].first, &a[i].second);
    a[i].index = i;
  }
  sort(a, a + N);
  set<pair<int, int> > q;
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    q.insert(make_pair(a[i].second, a[i].index));
    while (q.size() > K) q.erase(q.begin());
    if (q.size() == K)
      if (q.begin()->first - a[i].first + 1 > ans)
        ans = q.begin()->first - a[i].first + 1;
  }
  printf("%d\n", ans);
  if (ans == 0) {
    for (int i = 0; i < K; ++i) printf("%d ", i + 1);
    return 0;
  }
  q.clear();
  for (int i = 0; i < N; ++i) {
    q.insert(make_pair(a[i].second, a[i].index));
    while (q.size() > K) q.erase(q.begin());
    if (q.size() == K)
      if (q.begin()->first - a[i].first + 1 == ans) {
        set<pair<int, int> >::iterator iter = q.begin();
        for (; iter != q.end(); ++iter) printf("%d ", iter->second + 1);
        return 0;
      }
  }
  return 0;
}
