#include <bits/stdc++.h>
using namespace std;
int n;
long long a;
int l[300001], r[300001];
long long c[300001];
struct info {
  long long mcss, maxl, maxr, sum;
};
info v[300001];
long long d[300001];
pair<long long, int> gap[300001];
long long ans = 0;
info merge(info x, info y) {
  info z;
  z.sum = x.sum + y.sum;
  z.maxl = max(x.maxl, x.sum + y.maxl);
  z.maxr = max(y.maxr, x.maxr + y.sum);
  z.mcss = max(x.maxr + y.maxl, max(x.mcss, y.mcss));
  return z;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> a;
  for (int i = 1; i <= n; i++) {
    cin >> d[i] >> c[i];
    if (i != 1) gap[i - 1] = {d[i] - d[i - 1], i - 1};
    v[i] = {a - c[i], a - c[i], a - c[i], a - c[i]};
    ans = max(ans, a - c[i]);
    l[i] = r[i] = i;
  }
  sort(gap + 1, gap + n);
  for (int i = 1; i < n; i++) {
    int cur = gap[i].second;
    int nl = l[cur], nr = r[cur + 1];
    r[nl] = nr, l[nr] = nl;
    v[nl] = v[nr] = merge(v[nl], v[nr]);
    ans = max(ans, v[nl].mcss - gap[i].first * gap[i].first);
  }
  cout << ans << endl;
}
