#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int mn = 3e5 + 10;
const long long inf = 0x3f3f3f3f3f3f3f3f;
long long seg[mn * 4], laz[mn * 4];
inline void prop(int x) {
  if (!laz[x]) return;
  if (x * 2 + 1 < mn * 4) {
    laz[x * 2] += laz[x];
    laz[x * 2 + 1] += laz[x];
  }
  seg[x] += laz[x];
  laz[x] = 0;
}
inline void eval(int x) {
  prop(x * 2), prop(x * 2 + 1);
  seg[x] = max(seg[x * 2], seg[x * 2 + 1]);
}
void upd(int x, int l, int r, int a, int b, long long c) {
  if (l == a && r == b)
    laz[x] += c;
  else {
    prop(x);
    if (b <= ((l + r) >> 1))
      upd(x * 2, l, ((l + r) >> 1), a, b, c);
    else if (a > ((l + r) >> 1))
      upd(x * 2 + 1, ((l + r) >> 1) + 1, r, a, b, c);
    else
      upd(x * 2, l, ((l + r) >> 1), a, ((l + r) >> 1), c),
          upd(x * 2 + 1, ((l + r) >> 1) + 1, r, ((l + r) >> 1) + 1, b, c);
    eval(x);
  }
}
long long d[mn], c[mn];
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int n;
  long long a;
  cin >> n >> a;
  for (int i = 1; i <= n; i++) cin >> d[i] >> c[i], c[i] = a - c[i];
  for (int i = 1; i <= n; i++) d[i] = d[i + 1] - d[i], d[i] *= d[i];
  upd(1, 1, n, 1, n, -inf);
  long long ans = 0;
  stack<int> s;
  s.push(0);
  d[0] = inf;
  for (int i = 1; i <= n; i++) {
    upd(1, 1, n, i, i, inf);
    upd(1, 1, n, 1, i, c[i]);
    prop(1);
    ans = max(ans, seg[1]);
    while (s.size() && d[i] > d[s.top()]) {
      int x = s.top();
      s.pop();
      upd(1, 1, n, s.top() + 1, x, -d[i] + d[x]);
    }
    s.push(i);
    upd(1, 1, n, i, i, -d[i]);
  }
  printf("%lld", ans);
}
