#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  vector<pair<pair<int, int>, int>> a(n);
  for (int i = 0; i < n; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    a[i] = {{l, r}, i};
  }
  sort(a.begin(), a.end());
  bool printAns = false;
  int ans = 0;
  auto solve = [&]() {
    set<pair<int, int>> rs;
    for (int i = 0; i < n; i++) {
      if (rs.size() == k) {
        rs.erase(rs.begin());
      }
      rs.insert({a[i].first.second, a[i].second});
      if (rs.size() == k) {
        int l = a[i].first.first;
        int r = rs.begin()->first;
        auto curAns = r - l + 1;
        if (printAns) {
          if (ans == 0 || curAns == ans) {
            printf("%d\n", ans);
            for (auto pr : rs) {
              printf("%d ", pr.second + 1);
            }
            return;
          }
        } else {
          if (curAns > ans) {
            ans = curAns;
          }
        }
      }
    }
  };
  solve();
  printAns = true;
  solve();
}
