#include <bits/stdc++.h>
using namespace std;
struct sst {
  long long lf, rt, ko;
};
long long a[200003], b[220002], n;
long long binary(long long l) {
  long long i = 1, j = n, an = 1, mid;
  while (i <= j) {
    mid = (i + j) / 2;
    if (b[mid] >= l) {
      an = mid;
      j = mid - 1;
    } else
      i = mid + 1;
  }
  return an;
}
int main() {
  long long m, i, ok, ans = 0;
  cin >> n >> m;
  sst st[200003];
  st[0].rt = 0;
  for (i = 1; i <= n; i++) {
    cin >> st[i].lf >> st[i].rt;
    st[i - 1].ko = st[i].lf - st[i - 1].rt;
  }
  st[n].ko = 1000000000000;
  a[0] = b[0] = 0;
  for (i = 1; i <= n; i++) {
    a[i] = st[i].rt - st[i].lf;
    a[i] += a[i - 1];
    b[i] = st[i].ko;
    b[i] += b[i - 1];
  }
  for (i = 0; i <= n; i++) {
    ok = binary(m + b[i - 1]);
    ans = max(ans, m + a[ok] - a[i - 1]);
  }
  cout << ans << endl;
}
