#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e+5;
int n;
long long m, d;
long long a[maxn], b[maxn], s[maxn], ans;
int find(long long x, int ord) {
  int l = ord, r = n, tot = ord;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (s[2 * mid] <= x)
      tot = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  return tot;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
  for (int i = 2; i <= n; i++)
    s[2 * i] = s[2 * i - 1] = s[2 * (i - 1)] + a[i] - b[i - 1];
  for (int i = 1; i <= n; i++) {
    int k = find(m + s[2 * i], i);
    if (m == (s[2 * k] - s[2 * i]))
      ans = max(ans, a[k] - a[i]);
    else
      ans = max(ans, b[k] - a[i] + m - (s[2 * k] - s[2 * i]));
  }
  cout << ans << endl;
}
