#include <bits/stdc++.h>
using namespace std;
int n, k, ans, ansi;
pair<pair<int, int>, int> a[300005];
set<int> v, t;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++)
    scanf("%d %d", &a[i].first.first, &a[i].first.second), a[i].second = i;
  sort(a + 1, a + n + 1);
  set<pair<int, int> > s;
  for (int i = 1; i <= k; i++) s.insert({a[i].first.second, a[i].second});
  int r = s.begin()->first;
  ans = max(ans, r - a[k].first.first + 1);
  for (int i = k + 1; i <= n; i++) {
    s.erase(s.begin());
    s.insert({a[i].first.second, a[i].second});
    r = s.begin()->first;
    if (r - a[i].first.first + 1 > ans) {
      ans = r - a[i].first.first + 1;
      ansi = i;
    }
  }
  printf("%d\n", ans);
  if (ans == 0) {
    for (int i = 1; i <= k; i++) printf("%d ", i);
    printf("\n");
    return 0;
  }
  s.clear();
  for (int i = 1; i <= k; i++)
    s.insert({a[i].first.second, a[i].second}), t.insert(a[i].second);
  r = s.begin()->first;
  ans = max(ans, r - a[k].first.first + 1);
  for (int i = k + 1; i <= ansi; i++) {
    t.erase(s.begin()->second);
    s.erase(s.begin());
    s.insert({a[i].first.second, a[i].second});
    t.insert(a[i].second);
    r = s.begin()->first;
  }
  for (auto y : t) printf("%d ", y);
  printf("\n");
  return 0;
}
