#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m, g[200100 << 1], s[200100 << 1], ans;
int main() {
  n = read(), m = read(), s[0] = s[1] = 0;
  for (int i = 1; i <= 2 * n; i++) g[i] = read();
  for (int i = 3; i <= 2 * n; i += 2)
    s[i] = s[i + 1] = (g[i] - g[i - 1]) + s[i - 1];
  for (int i = 1, t, res; i <= 2 * n; i += 2) {
    t = upper_bound(s + 1, s + 2 * n + 1, s[i] + m) - s;
    if (s[t - 1] - s[i] == m)
      res = g[t - 2] - g[i];
    else
      res = m - s[t - 1] + s[i] + g[t - 1] - g[i];
    ans = max(ans, res);
  }
  printf("%d", ans);
}
