#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], loga[maxn], par[maxn], L[maxn], R[maxn];
long long pref[maxn], mx[maxn][20], mn[maxn][20], 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, int i, long long d) {
  a = root(a), b = root(b);
  int l = min(L[a], L[b]), r = max(R[a], R[b]);
  int len = (i - 1) - (l - 1) + 1;
  long long mini =
      min(mn[l - 1][loga[len]], mn[i - 1 - (1 << loga[len]) + 1][loga[len]]);
  len = r - (i + 1) + 1;
  long long maxi =
      max(mx[i + 1][loga[len]], mx[r - (1 << loga[len]) + 1][loga[len]]);
  ans = max(ans, maxi - mini - d * d);
  par[b] = a;
  L[a] = l, R[a] = r;
}
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] = L[i] = R[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];
  for (int i = 1; i <= n; i++) mn[i][0] = mx[i][0] = pref[i];
  for (int siz = 1; siz < 20; siz++) {
    int p = (1 << (siz - 1));
    for (int i = 0; i <= n; i++) {
      if (i + 2 * p - 1 > n) break;
      mx[i][siz] = max(mx[i][siz - 1], mx[i + p][siz - 1]);
      mn[i][siz] = min(mn[i][siz - 1], mn[i + p][siz - 1]);
    }
  }
  loga[1] = 0;
  for (int i = 2; i < maxn; i++) loga[i] = loga[i / 2] + 1;
  sort(diffs + 1, diffs + n);
  for (int i = 1; i < n; i++)
    unite(diffs[i].second, diffs[i].second + 1, diffs[i].second,
          diffs[i].first);
  cout << ans << "\n";
  return 0;
}
