#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n, a, d[maxn], c[maxn], diff[maxn], par[maxn];
long long pref[maxn], mx[maxn], mn[maxn], ans;
pair<int, int> diffs[maxn];
int root(int v) { return v == par[v] ? v : par[v] = root(par[v]); }
void unite(int a, int b, long long d) {
  a = root(a), b = root(b);
  ans = max(ans, mx[b] - mn[a] - d * d);
  mx[a] = max(mx[a], mx[b]);
  mn[a] = min(mn[a], mn[b]);
  par[b] = a;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n >> a;
  for (int i = 1; i <= n; i++) {
    cin >> d[i] >> c[i];
    c[i] = a - c[i];
    ans = max(ans, 1ll * c[i]);
    par[i] = i;
  }
  for (int i = 1; i < n; i++) {
    diff[i] = d[i + 1] - d[i];
    diffs[i] = {diff[i], i};
  }
  for (int i = 1; i <= n; i++) {
    pref[i] = pref[i - 1] + c[i];
    mn[i] = pref[i - 1];
    mx[i] = pref[i];
  }
  sort(diffs + 1, diffs + n);
  for (int i = 1; i < n; i++)
    unite(diffs[i].second, diffs[i].second + 1, diffs[i].first);
  cout << ans << "\n";
  return 0;
}
