#include <bits/stdc++.h>
using namespace std;
const int maxn = 333333;
long long d[maxn], c[maxn];
long long n, a;
long long sum[maxn];
long long mm[2][maxn][33];
inline long long max(long long a, long long b) { return a > b ? a : b; }
inline long long min(long long a, long long b) { return a < b ? a : b; }
void cal_rmq() {
  for (int i = 0; (1 << i) <= n + 1; i++) {
    int len = 1 << i;
    for (int j = 0; j + (1 << i) - 1 <= n; j++) {
      if (len == 1) {
        mm[0][j][i] = mm[1][j][i] = sum[j];
      } else {
        int r = j + (1 << (i - 1));
        mm[0][j][i] = min(mm[0][j][i - 1], mm[0][r][i - 1]);
        mm[1][j][i] = max(mm[1][j][i - 1], mm[1][r][i - 1]);
      }
    }
  }
}
long long rmq(int L, int R, int id) {
  int d = 0;
  while (L + (1 << (d + 1)) - 1 <= R) d++;
  if (id == 0) return min(mm[0][L][d], mm[0][R - (1 << d) + 1][d]);
  return max(mm[1][L][d], mm[1][R - (1 << d) + 1][d]);
}
long long gaps[maxn];
int l[maxn], r[maxn];
stack<int> q;
int main() {
  cin >> n >> a;
  for (int i = 1; i <= n; i++) cin >> d[i] >> c[i];
  sum[0] = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + a - c[i];
    ans = max(ans, a - c[i]);
    gaps[i] = d[i] - d[i - 1];
  }
  cal_rmq();
  for (int i = 1; i <= n; i++) {
    if (i > 1) {
      while (!q.empty() && gaps[q.top()] <= gaps[i]) q.pop();
      l[i] = (!q.empty()) ? q.top() : 1;
      q.push(i);
    }
  }
  while (!q.empty()) q.pop();
  for (int i = n; i >= 1; i--) {
    if (i > 1) {
      while (!q.empty() && gaps[q.top()] <= gaps[i]) q.pop();
      r[i] = (!q.empty()) ? q.top() - 1 : n;
      q.push(i);
      ans = max(ans,
                -gaps[i] * gaps[i] + rmq(i, r[i], 1) - rmq(l[i] - 1, i - 2, 0));
    }
  }
  cout << ans << endl;
  return 0;
}
