#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e9 + 1;
struct seg {
  int x;
  int y;
  int v;
  bool operator<(const seg& a) const { return v < a.v; }
} s[290000];
int n, h;
int read() {
  int x = 0;
  int k = 1;
  char c = getchar();
  while (c > '9' || c < '0')
    if (c == '-')
      k = -1, c = getchar();
    else
      c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return k * x;
}
bool is_ok(int k) {
  int u = k - h;
  int sum = s[1].v;
  int p1 = 1, p2 = 1;
  while (1) {
    if (sum == u && s[p2].y - s[p1].x < k) return true;
    if (sum < u) sum += s[++p2].v;
    if (sum > u) sum -= s[p1++].v;
  }
}
void binary_it(int l, int r) {
  int mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (is_ok(mid))
      binary_it(mid, r);
    else
      binary_it(l, mid - 1);
  }
  cout << mid;
}
int main() {
  n = read();
  h = read();
  for (int i = 1; i <= n; ++i)
    s[i].x = read(), s[i].y = read(), s[i].v = s[i].y - s[i].x;
  int ans = -1;
  int sum = s[1].v;
  int p1 = 1, p2 = 1;
  while (1) {
    if (s[p2].y - s[p1].x - sum < h)
      if (p2 + 1 <= n) {
        ans = max(ans, sum + h), sum += s[++p2].v;
      } else {
        ans = max(ans, sum + h);
        break;
      }
    if (s[p2].y - s[p1].x - sum >= h) {
      sum -= s[p1++].v;
    }
  }
  cout << ans;
  return 0;
}
