#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int MAXN = 2e5 + 100;
pair<int, int> a[MAXN];
int dp[MAXN], n, m;
int binary_search(int low, int high) {
  int l = lower_bound(a, a + n, make_pair(low, -1)) - a;
  int r = lower_bound(a, a + n, make_pair(high, -1)) - a;
  int ok = dp[r] - dp[l];
  if (l > 0) ok += max(0, a[l - 1].second - low);
  return (high - low - ok);
}
void solve() {
  int res = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  sort(a, a + n);
  dp[0] = 0;
  for (int i = 0; i < n; i++) dp[i + 1] = dp[i] + (a[i].second - a[i].first);
  for (int i = 0; i < n; i++) {
    int check = a[i].second + 1;
    int l = -(m + 1);
    int r = check;
    while (r - l > 1) {
      int md = (l + r) >> 1;
      if (binary_search(md, check) > m)
        l = md;
      else
        r = md;
    }
    res = max(res, check - r);
  }
  cout << res << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
