#include <bits/stdc++.h>
long long fpw(long long a, unsigned long long b, long long p) {
  long long r = 1;
  while (b) {
    if (b & 1) r = r * a % p;
    a = a * a % p;
    b /= 2;
  }
  return (long long)r;
}
using namespace std;
long long n, m;
struct Node {
  long long maxi = 0;
  long long mod = 0;
  long long earn = 0;
  long long gap = 0;
};
const long long rg = 1 << 19;
const long long sz = rg * 2;
Node tree[sz];
void update(long long i, long long start, long long meta) {
  tree[i * 2].mod += tree[i].mod;
  tree[i * 2 + 1].mod += tree[i].mod;
  tree[i * 2].maxi += tree[i].mod;
  tree[i * 2 + 1].maxi += tree[i].mod;
  tree[i * 2].earn += tree[i].mod;
  tree[i * 2 + 1].earn += tree[i].mod;
  tree[i].mod = 0;
  if (tree[i].gap != 0) {
    tree[i * 2].gap = tree[i * 2 + 1].gap = tree[i].gap;
    tree[i * 2].earn = tree[i * 2].maxi - tree[i].gap;
    tree[i * 2 + 1].earn = tree[i * 2 + 1].maxi - tree[i].gap;
    tree[i].gap = 0;
  }
}
pair<long long, long long> add(long long i, long long start, long long meta,
                               long long a, long long b, long long mod) {
  if (start != meta) update(i, start, meta);
  if (a <= start and b >= meta) {
    tree[i].mod += mod;
    tree[i].maxi += mod;
    tree[i].earn += mod;
    return {tree[i].maxi, tree[i].earn};
  }
  if (a > meta or b < start) return {tree[i].maxi, tree[i].earn};
  long long s = (start + meta) / 2;
  pair<long long, long long> l = add(i * 2, start, s, a, b, mod);
  pair<long long, long long> r = add(i * 2 + 1, s + 1, meta, a, b, mod);
  tree[i].maxi = max(l.first, r.first);
  tree[i].earn = max(l.second, r.second);
  return {tree[i].maxi, tree[i].earn};
}
pair<long long, long long> setGap(long long i, long long start, long long meta,
                                  long long a, long long b, long long gap) {
  if (start != meta) update(i, start, meta);
  if (a <= start and b >= meta) {
    tree[i].gap = gap;
    tree[i].earn = tree[i].maxi - tree[i].gap;
    return {tree[i].maxi, tree[i].earn};
  }
  if (a > meta or b < start) return {tree[i].maxi, tree[i].earn};
  ;
  long long s = (start + meta) / 2;
  pair<long long, long long> l = setGap(i * 2, start, s, a, b, gap);
  pair<long long, long long> r = setGap(i * 2 + 1, s + 1, meta, a, b, gap);
  tree[i].maxi = max(l.first, r.first);
  tree[i].earn = max(l.second, r.second);
  return {tree[i].maxi, tree[i].earn};
}
long long getMax(long long i, long long start, long long meta, long long a,
                 long long b) {
  if (start != meta) update(i, start, meta);
  if (a <= start and b >= meta) {
    return tree[i].earn;
  }
  if (a > meta or b < start) return 0;
  long long s = (start + meta) / 2;
  long long l = getMax(i * 2, start, s, a, b);
  long long r = getMax(i * 2 + 1, s + 1, meta, a, b);
  return max(l, r);
}
long long getM(long long a, long long b) {
  add(1, 1, rg, a, b, 0);
  return getMax(1, 1, rg, a, b);
}
long long tab[300004][2];
long long pre[300004];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (long long i = 1; i <= n; ++i) cin >> tab[i][0] >> tab[i][1];
  for (long long i = 1; i <= n; ++i) {
    long long val = (tab[i][0] - tab[i - 1][0]) * (tab[i][0] - tab[i - 1][0]);
  }
  vector<pair<long long, long long> > s;
  s.push_back({1, 1e18});
  for (long long i = 2; i <= n; ++i) {
    long long val = (tab[i][0] - tab[i - 1][0]) * (tab[i][0] - tab[i - 1][0]);
    while (s.back().second < val) s.pop_back();
    pre[i] = s.back().first;
    s.push_back({i, val});
  }
  long long best = -1e18;
  for (long long i = 1; i <= n; ++i) {
    add(1, 1, rg, 1, i, m - tab[i][1]);
    if (i > 1) {
      setGap(1, 1, rg, pre[i], i - 1,
             (tab[i][0] - tab[i - 1][0]) * (tab[i][0] - tab[i - 1][0]));
    }
    best = max(best, getM(1, i));
  }
  cout << best << endl;
}
