#include <bits/stdc++.h>
using namespace std;
const int Nmax = 300000 + 5;
pair<pair<int, int>, int> v[Nmax];
priority_queue<int, vector<int>, greater<int> > q;
int n, k, ans, poz;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i].first.first >> v[i].first.second;
    v[i].second = i;
  }
  sort(v + 1, v + n + 1);
  for (int i = 1; i <= n; ++i) {
    if (q.size() < k)
      q.push(v[i].first.second);
    else if (q.top() < v[i].first.second) {
      q.pop();
      q.push(v[i].first.second);
    }
    if (q.size() == k && q.top() - v[i].first.first + 1 > ans) {
      ans = q.top() - v[i].first.first + 1;
      poz = i;
    }
  }
  if (ans) {
    cout << ans << '\n';
    for (int i = 1; i <= poz; ++i)
      if (v[i].first.second >= v[poz].first.first + ans - 1)
        cout << v[i].second << " ";
  } else {
    cout << 0 << '\n';
    for (int i = 1; i <= k; ++i) cout << i << " ";
  }
  return 0;
}
