#include <bits/stdc++.h>
using namespace std;
pair<int, pair<int, int>> ranges[300300];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    ranges[i] = {l, {r, i + 1}};
  }
  sort(ranges, ranges + n);
  int max_length = 0;
  priority_queue<pair<int, int>> pq;
  for (int i = 0; i < n; i++) {
    if (pq.size() < k - 1) {
      pq.push({-ranges[i].second.first, ranges[i].second.second});
      continue;
    }
    pq.push({-ranges[i].second.first, ranges[i].second.second});
    int max_left = ranges[i].first;
    int min_right = -pq.top().first;
    max_length = max(max_length, min_right - max_left + 1);
    pq.pop();
  }
  while (!pq.empty()) pq.pop();
  cout << max_length << '\n';
  for (int i = 0; i < n; i++) {
    if (pq.size() < k - 1) {
      pq.push({-ranges[i].second.first, ranges[i].second.second});
      continue;
    }
    pq.push({-ranges[i].second.first, ranges[i].second.second});
    int max_left = ranges[i].first;
    int min_right = -pq.top().first;
    int cur_length = max(min_right - max_left + 1, 0);
    if (cur_length == max_length) {
      while (!pq.empty()) {
        cout << pq.top().second << ' ';
        pq.pop();
      }
      return 0;
    }
    pq.pop();
  }
}
