#include <bits/stdc++.h>
using namespace std;
int binary_search(vector<pair<int, int>> &v, int val, int l, int r) {
  if (l > r) return v.size();
  int mid = (l + r) / 2;
  while (l < r) {
    if (v[mid].first > val) {
      r = mid;
    } else {
      l = mid + 1;
    }
    mid = (l + r) / 2;
  }
  return v[mid].first >= val ? mid : v.size();
}
int main() {
  int n;
  long long h;
  cin >> n >> h;
  vector<long long> x(n), y(n), sum(n + 1), t(n + 1);
  sum[0] = 0;
  long long ans = -1;
  vector<pair<int, int>> v;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    t[i] = sum[i] + x[i];
    sum[i + 1] = t[i] - y[i];
    while (v.size() > 0 && v.back().first >= t[i]) {
      v.pop_back();
    }
    v.push_back(make_pair(t[i], i));
    int index = binary_search(v, t[i] - h, 0, v.size() - 1);
    if (index < v.size()) {
      int id = v[index].second;
      long long ES = h - sum[i + 1] + sum[id];
      if (ES <= 2e9) {
        if (ES > ans) {
          ans = max(ans, ES);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
