#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 300005;
template <typename T>
class segtree {
 private:
  int n, sz, h;
  vector<T> node, lazy;
  void eval(int k) {
    if (lazy[k]) {
      node[k] += lazy[k];
      if (k < n) {
        lazy[k * 2] += lazy[k], lazy[k * 2 + 1] += lazy[k];
      }
      lazy[k] = 0;
    }
  }

 public:
  segtree(vector<T>& v) : sz((int)v.size()), h(0) {
    n = 1;
    while (n < sz) n *= 2, h++;
    node.resize(2 * n, numeric_limits<T>::min());
    lazy.resize(2 * n, 0);
    for (int i = 0; i < sz; i++) node[i + n] = v[i];
    for (int i = n - 1; i >= 1; i--)
      node[i] = max(node[2 * i], node[2 * i + 1]);
  }
  void range(int a, int b, T x, int k = 1, int l = 0, int r = -1) {
    if (r < 0) r = n;
    eval(k);
    if (b <= l || r <= a) {
      return;
    }
    if (a <= l && r <= b) {
      lazy[k] += x;
      eval(k);
    } else {
      range(a, b, x, 2 * k, l, (l + r) / 2);
      range(a, b, x, 2 * k + 1, (l + r) / 2, r);
      node[k] = max(node[2 * k], node[2 * k + 1]);
    }
  }
  T query(int a, int b) {
    a += n, b += n - 1;
    for (int i = h; i > 0; i--) eval(a >> i), eval(b >> i);
    b++;
    T res1 = numeric_limits<T>::min(), res2 = numeric_limits<T>::min();
    while (a < b) {
      if (a & 1) eval(a), res1 = max(res1, node[a++]);
      if (b & 1) eval(--b), res2 = max(res2, node[b]);
      a >>= 1, b >>= 1;
    }
    return max(res1, res2);
  }
  void print() {
    for (int i = 0; i < sz; i++) cout << query(i, i + 1) << " ";
    cout << endl;
  }
};
struct info {
  int l, r;
  long long val;
};
vector<info> vec;
long long d[MAX_N];
int c[MAX_N];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a;
  cin >> n >> a;
  for (int i = 0; i < (int)(n); ++i) {
    cin >> d[i] >> c[i];
  }
  vector<long long> hoge(n, 0);
  segtree<long long> sg(hoge);
  vec.push_back((info){0, 1, 0});
  long long ans = 0;
  for (int i = 0; i < (int)(n); ++i) {
    sg.range(0, i + 1, a - c[i]);
    if (i == 0) {
      ans = max(ans, sg.query(0, i + 1));
      continue;
    }
    info hoge = vec.back();
    int st = -1;
    long long val = (d[i] - d[i - 1]) * (d[i] - d[i - 1]);
    if (hoge.val < val) {
      while (hoge.val < val) {
        sg.range(hoge.l, hoge.r, hoge.val - val);
        st = hoge.l;
        vec.pop_back();
        if ((int)(vec).size() == 0) {
          break;
        }
        hoge = vec.back();
      }
      vec.push_back((info){st, i, val});
    } else {
      vec.back().r++;
    }
    vec.push_back((info){i, i + 1, 0});
    ans = max(ans, sg.query(0, i + 1));
  }
  cout << ans << "\n";
  return 0;
}
