#include <bits/stdc++.h>
using namespace std;
const int NSIZ = 1000010;
const int MSIZ = 1000010;
const int inf = 1010580540;
const int mxint = 2147483647;
const long long mxll = 9223372036854775807LL;
const long long prime15 = 1000000000000037LL;
const long long mod = 1000000007LL;
const long long mod9 = 1000000009LL;
int n, m, o, re = -inf, test;
long long res = 0;
pair<int, int> a[NSIZ];
int b[NSIZ];
bool chk[NSIZ];
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    pq;
vector<int> ans;
bool compare(int x, int y) { return a[x] < a[y]; }
int main() {
  int i, j, k, l;
  long long ll = 0, rr = mxll, mid;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%d %d", &a[i].first, &a[i].second);
    b[i] = i;
  }
  sort(b, b + n, compare);
  for (i = 0; i < m; i++) {
    pq.push(pair<int, int>(a[b[i]].second, b[i]));
  }
  re = pq.top().first - a[b[m - 1]].first + 1;
  for (i = m; i < n; i++) {
    pq.pop();
    pq.push(pair<int, int>(a[b[i]].second, b[i]));
    re = max(re, pq.top().first - a[b[i]].first + 1);
  }
  while (!pq.empty()) pq.pop();
  for (i = 0; i < m; i++) {
    pq.push(pair<int, int>(a[b[i]].second, b[i]));
  }
  if (re != pq.top().first - a[b[m - 1]].first + 1 && re >= 0) {
    for (i = m; i < n; i++) {
      pq.pop();
      pq.push(pair<int, int>(a[b[i]].second, b[i]));
      if (re == pq.top().first - a[b[i]].first + 1) break;
    }
  }
  if (re < 0) re = 0;
  printf("%d\n", re);
  while (!pq.empty()) {
    ans.push_back(pq.top().second);
    pq.pop();
  }
  sort(ans.begin(), ans.end());
  for (int i : ans) {
    printf("%d ", i + 1);
  }
  return 0;
}
