#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int n, k, sol;
struct ss {
  int L, R, pi;
};
ss v[300002];
bool cmp(ss a, ss b) {
  if (a.L == b.L) return a.R > b.R;
  return a.L < b.L;
}
multiset<pair<pair<int, int>, int> > s;
multiset<pair<pair<int, int>, int> >::iterator it;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i].L >> v[i].R;
    v[i].pi = i;
  }
  sort(v + 1, v + n + 1, cmp);
  for (int i = 1; i <= k; ++i) s.insert({{v[i].R, v[i].L}, v[i].pi});
  it = s.begin();
  sol = max(sol, it->first.first - v[k].L + 1);
  for (int i = k + 1; i <= n; ++i) {
    s.erase(s.begin());
    s.insert({{v[i].R, v[i].L}, v[i].pi});
    it = s.begin();
    sol = max(sol, it->first.first - v[i].L + 1);
  }
  cout << sol << '\n';
  if (sol == 0) {
    for (int i = 1; i <= k; ++i) cout << v[i].pi << " ";
    return 0;
  }
  s.clear();
  for (int i = 1; i <= k; ++i) s.insert({{v[i].R, v[i].L}, v[i].pi});
  it = s.begin();
  if (it->first.first - v[k].L + 1 == sol) {
    for (it = s.begin(); it != s.end(); ++it) cout << it->second << " ";
    return 0;
  }
  for (int i = k + 1; i <= n; ++i) {
    s.erase(s.begin());
    s.insert({{v[i].R, v[i].L}, v[i].pi});
    it = s.begin();
    if (it->first.first - v[i].L + 1 == sol) {
      for (it = s.begin(); it != s.end(); ++it) cout << it->second << " ";
      return 0;
    }
  }
  return 0;
}
