#include <bits/stdc++.h>
using namespace std;
long long pref[(int)3e5 + 5];
long long suf[(int)3e5 + 5];
long long tot[(int)3e5 + 5];
long long maxi[(int)3e5 + 5];
set<int> heads;
struct DSU {
  vector<int> rank;
  vector<int> parent;
  DSU(int n) {
    rank.resize(n, 1);
    parent.resize(n);
    for (int i = 0; i < n; ++i) parent[i] = i;
  }
  long long calc(int l, int r, int save) {
    long long tp = max(pref[l], tot[l] + pref[r]);
    long long ts = max(suf[r], tot[r] + suf[l]);
    long long tt = tot[l] + tot[r];
    long long tm = max(suf[l] + pref[r], max(maxi[l], maxi[r]));
    pref[save] = tp;
    suf[save] = ts;
    tot[save] = tt;
    maxi[save] = tm;
    return maxi[save];
  }
  int find(const int u) {
    return parent[u] == u ? u : (parent[u] = find(parent[u]));
  }
  long long merge(int u, int v) {
    if ((u = find(u)) == (v = find(v))) return maxi[u];
    if (rank[u] < rank[v]) swap(u, v);
    rank[u] += rank[v];
    parent[v] = u;
    return calc(min(u, v), max(u, v), u);
  }
  int size(int u) { return rank[find(u)]; }
};
unordered_map<int, vector<int>> occ;
long long val[(int)3e5 + 5];
int D[(int)3e5 + 5];
set<int> diffs;
DSU dsu(3e5 + 5);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N, a;
  cin >> N >> a;
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    int d;
    cin >> D[i] >> val[i];
    ans = max(ans, val[i] = a - val[i]);
  }
  for (int i = 0; i < N; i++) {
    pref[i] = suf[i] = maxi[i] = max(0ll, val[i]);
    tot[i] = val[i];
  }
  for (int i = 1; i < N; i++) {
    int tmp = D[i] - D[i - 1];
    diffs.insert(tmp);
    if (occ.count(tmp) == 0)
      occ[tmp] = {i};
    else
      occ[tmp].push_back(i);
  }
  for (int d : diffs) {
    for (int ind : occ[d]) {
      long long tmp = dsu.merge(ind, ind - 1) - (long long)d * (long long)d;
      ans = max(ans, tmp);
    }
  }
  cout << ans;
  return 0;
}
