#include <bits/stdc++.h>
using namespace std;
long long int n, k, Ti = 0, l;
pair<pair<long long int, long long int>, long long int> cou[300005];
priority_queue<long long int, vector<long long int>, greater<long long int> > r;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> cou[i].first.first >> cou[i].first.second;
    cou[i].second = i + 1;
  }
  sort(cou, cou + n);
  for (int i = 0; i < n; i++) {
    r.push(cou[i].first.second);
    if (r.size() > k) r.pop();
    if (r.size() == k) {
      if (r.top() - cou[i].first.first + 1 > Ti) {
        Ti = r.top() - cou[i].first.first + 1;
        l = cou[i].first.first;
      }
    }
  }
  if (Ti == 0) {
    cout << 0 << endl;
    for (int i = 1; i <= k; i++) cout << i << " ";
  } else {
    cout << Ti << endl;
    for (int i = 0; i < n && k; i++) {
      if (cou[i].first.first <= l && cou[i].first.second >= l + Ti - 1)
        cout << cou[i].second << " ", k--;
    }
  }
  return 0;
}
