#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  ;
  long long i, j, k, l, r, m, n, o, t, h;
  cin >> n >> k;
  pair<pair<long long, long long>, long long> arr[300001];
  for (i = 1; i <= n; i++) {
    cin >> arr[i].first.first >> arr[i].first.second;
    arr[i].second = i;
  }
  sort(arr + 1, arr + n + 1);
  multiset<pair<long long, long long> > hi;
  for (i = 1; i <= k; i++) {
    hi.insert(make_pair(arr[i].first.second, arr[i].second));
  }
  l = arr[k].first.first;
  h = hi.begin()->first;
  for (i = k + 1; i <= n; i++) {
    hi.erase(hi.begin());
    hi.insert(make_pair(arr[i].first.second, arr[i].second));
    o = hi.begin()->first;
    j = arr[i].first.first;
    if (o - j > h - l) {
      h = o;
      l = j;
    }
  }
  if (l > h) {
    cout << 0 << endl;
    for (i = 1; i <= k; i++) cout << i << " ";
    cout << endl;
  } else {
    cout << h - l + 1 << endl;
    j = 0;
    for (i = 1; i <= n; i++) {
      if (j == k) break;
      if (arr[i].first.first <= l && arr[i].first.second >= h) {
        cout << arr[i].second << " ";
        j++;
      }
    }
    cout << endl;
  }
}
