#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
const long long INF = 5e18;
int c[N], d[N];
long long pre[N], minx[N], rec[N];
stack<int> st;
int main() {
  int n, a, sz;
  long long ans, now;
  scanf("%d %d", &n, &a);
  for (int i = 1; i <= n; i++) scanf("%d %d", &d[i], &c[i]);
  pre[0] = 0;
  for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + a - c[i];
  for (int i = n; i >= 2; i--) d[i] -= d[i - 1];
  ans = 0;
  for (int i = 1; i <= n; i++) ans = max(ans, 0LL + a - c[i]);
  rec[0] = INF;
  for (int i = 2; i <= n; i++) {
    now = INF;
    while (!st.empty() && d[st.top()] <= d[i]) {
      now = min(now, minx[(int)st.size()]);
      st.pop();
    }
    st.push(i);
    sz = (int)st.size();
    minx[sz] = min(now, pre[i - 2]);
    rec[sz] = min(rec[sz - 1], 1LL * d[i] * d[i] + minx[sz]);
    ans = max(ans, pre[i] - rec[sz]);
  }
  printf("%I64d\n", ans);
  return 0;
}
