#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
struct Node {
  long long lsum, rsum, maxsum, sum;
};
Node tree[1048576];
void upd(int node, int S, int E, int i, long long k) {
  if (S == E) {
    tree[node].lsum = k;
    tree[node].rsum = k;
    tree[node].maxsum = k;
    tree[node].sum = k;
    return;
  }
  if (i <= (S + E) / 2)
    upd(node * 2, S, (S + E) / 2, i, k);
  else
    upd(node * 2 + 1, (S + E) / 2 + 1, E, i, k);
  tree[node].lsum =
      max(tree[node * 2].lsum, tree[node * 2].sum + tree[node * 2 + 1].lsum);
  tree[node].rsum = max(tree[node * 2 + 1].rsum,
                        tree[node * 2 + 1].sum + tree[node * 2].rsum);
  tree[node].sum = tree[node * 2].sum + tree[node * 2 + 1].sum;
  tree[node].maxsum = max({tree[node * 2].maxsum, tree[node * 2 + 1].maxsum,
                           tree[node * 2].rsum + tree[node * 2 + 1].lsum});
}
Node find(int node, int S, int E, int i, int j) {
  Node T = {-987654321987654321, -987654321987654321, -987654321987654321,
            -987654321987654321};
  if (i > E || j < S) return T;
  if (i <= S && j >= E) return tree[node];
  Node L = find(node * 2, S, (S + E) / 2, i, j);
  Node R = find(node * 2 + 1, (S + E) / 2 + 1, E, i, j);
  if (L.lsum == T.lsum) return R;
  if (R.lsum == T.lsum) return L;
  T.lsum = max(L.lsum, L.sum + R.lsum);
  T.rsum = max(R.rsum, R.sum + L.rsum);
  T.sum = L.sum + R.sum;
  T.maxsum = max({L.maxsum, R.maxsum, L.rsum + R.lsum});
  return T;
}
pair<int, int> p[300000];
set<pair<int, int> > S;
int main() {
  int n, x;
  scanf("%d%d", &n, &x);
  for (int(i) = (0); (i) <= (n - 1); (i) += (1)) {
    scanf("%d%d", &p[i].first, &p[i].second);
    p[i].second = x - p[i].second;
  }
  for (int(i) = (0); (i) <= (n - 1); (i) += (1))
    upd(1, 0, n - 1, i, p[i].second);
  long long ans = 0;
  for (int(i) = (0); (i) <= (n - 1); (i) += (1)) {
    S.insert(make_pair(i, i));
    ans = max(ans, (long long)p[i].second);
  }
  vector<pair<int, int> > v;
  for (int(i) = (0); (i) <= (n - 2); (i) += (1)) {
    v.push_back(make_pair(p[i + 1].first - p[i].first, i));
  }
  sort(v.begin(), v.end());
  int l = 0, r = 0;
  int N = v.size();
  while (l < N) {
    r = l;
    while (r + 1 < N && v[l].first == v[r + 1].first) r++;
    long long d = 1LL * v[l].first * v[l].first;
    for (int(i) = (l); (i) <= (r); (i) += (1)) {
      auto it = S.lower_bound(make_pair(v[i].second, 987654321));
      auto R = *it;
      it--;
      auto L = *it;
      S.erase(L);
      S.erase(R);
      ans = max(ans, find(1, 0, n - 1, L.first, R.second).maxsum - d);
      S.insert(make_pair(L.first, R.second));
    }
    l = r + 1;
  }
  printf("%lld", ans);
}
