#include <bits/stdc++.h>
using namespace std;
void dout() { cerr << '\n'; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cerr << " " << H;
  dout(T...);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 3e5 + 123;
const long long inf = 1e18;
int n, d[N], c[N], l[N], r[N], a;
long long p[N], val[N];
struct node {
  int l = 0, r = 0;
  long long mx = 0, mn = 0, ans = 0;
  node() { mx = -inf, mn = inf, ans = -inf; }
  void clear() {
    l = 0, r = 0;
    mx = -inf, mn = inf, ans = -inf;
  }
};
node t[(1 << 20) + 1];
node merge(node x, node y) {
  if (x.l == 0 && x.r == 0) {
    return y;
  }
  node res;
  res.ans = max(x.ans, y.ans);
  res.ans = max(res.ans, y.mx - x.mn);
  res.ans = max(res.ans, y.mx - val[x.l - 1]);
  res.l = x.l, res.r = y.r;
  res.mx = max(x.mx, y.mx);
  res.mn = min(x.mn, y.mn);
  return res;
}
node res, tmp;
void build(int v, int l, int r) {
  t[v].l = l, t[v].r = r;
  if (l == r) {
    t[v].mn = t[v].mx = val[l];
    t[v].ans = val[l] - val[l - 1];
    return;
  }
  int m = l + r >> 1;
  build(v << 1, l, m);
  build(v << 1 | 1, m + 1, r);
  t[v] = merge(t[v << 1], t[v << 1 | 1]);
}
void get(int v, int l, int r) {
  if (t[v].l > r || t[v].r < l) {
    return;
  }
  if (t[v].l >= l && t[v].r <= r) {
    res = merge(res, t[v]);
    return;
  }
  get(v << 1, l, r);
  get(v << 1 | 1, l, r);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  cin >> n >> a;
  for (int i = 1; i <= n; i++) {
    cin >> d[i] >> c[i];
    p[i] = p[i - 1] + c[i];
    val[i] = (long long)i * a - p[i];
  }
  build(1, 1, n);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, (long long)a - c[i]);
  }
  stack<int> st;
  for (int i = 2; i <= n; i++) {
    while (!st.empty() && d[st.top()] - d[st.top() - 1] <= d[i] - d[i - 1]) {
      st.pop();
    }
    if (!st.empty()) {
      l[i] = st.top();
    } else {
      l[i] = 1;
    }
    st.push(i);
  }
  while (!st.empty()) {
    st.pop();
  }
  for (int i = n; i >= 2; i--) {
    while (!st.empty() && d[st.top()] - d[st.top() - 1] <= d[i] - d[i - 1]) {
      st.pop();
    }
    if (!st.empty()) {
      r[i] = st.top() - 1;
    } else {
      r[i] = n;
    }
    st.push(i);
  }
  for (int i = 2; i <= n; i++) {
    res.clear();
    get(1, l[i], i);
    tmp = res;
    res.clear();
    get(1, i, r[i]);
    ans = max(ans, merge(tmp, res).ans -
                       ((long long)d[i] - d[i - 1]) * (d[i] - d[i - 1]));
  }
  cout << ans;
}
