#include <bits/stdc++.h>
using namespace std;
int n, m, t = 1, cnt, ans, x1[200005], x2[200005];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &x1[i], &x2[i]);
  ans = x2[1] - x1[1] + m;
  for (int i = 2; i <= n; ++i) {
    cnt += x1[i] - x2[i - 1];
    while (cnt >= m) {
      cnt -= x1[t + 1] - x2[t];
      t++;
    }
    ans = max(ans, x2[i] - x1[t] + m - cnt);
  }
  printf("%d", ans);
}
