#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int N = 300005;
int st[N];
long long a, d[N], c[N], val[N];
int n, lst[N], nxt[N];
int q[N], head, tail;
struct node {
  long long sum, lmax, rmax;
} t[N << 2];
void pushup(int x, int l, int r) {
  int mid = (l + r) >> 1;
  t[x].sum = t[x << 1].sum + t[x << 1 | 1].sum;
  t[x].lmax = max(t[x << 1].lmax, t[x << 1 | 1].lmax + t[x << 1].sum);
  t[x].rmax = max(t[x << 1 | 1].rmax, t[x << 1].rmax + t[x << 1 | 1].sum);
}
void build(int x, int l, int r) {
  if (l == r) {
    t[x].sum = t[x].lmax = t[x].rmax = a - c[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(x << 1, l, mid);
  build(x << 1 | 1, mid + 1, r);
  pushup(x, l, r);
}
node query(int x, int l, int r, int L, int R) {
  if (L <= l && r <= R) return t[x];
  int mid = (l + r) >> 1;
  bool flag1 = 0, flag2 = 0;
  node ret1, ret2, ret;
  if (L <= mid) flag1 = 1, ret1 = query(x << 1, l, mid, L, R);
  if (R > mid) flag2 = 1, ret2 = query(x << 1 | 1, mid + 1, r, L, R);
  if (!flag2) return ret1;
  if (!flag1) return ret2;
  ret.sum = ret1.sum + ret2.sum;
  ret.lmax = max(ret1.lmax, ret1.sum + ret2.lmax);
  ret.rmax = max(ret2.rmax, ret2.sum + ret1.rmax);
  return ret;
}
int main() {
  scanf("%d%lld", &n, &a);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld%lld", &d[i], &c[i]);
  }
  for (int i = 2; i <= n; ++i) {
    val[i] = (d[i] - d[i - 1]) * (d[i] - d[i - 1]);
  }
  int top = 0;
  for (int i = 2; i <= n; ++i) {
    while (top && val[st[top]] <= val[i]) --top;
    if (top)
      lst[i] = st[top];
    else
      lst[i] = 1;
    st[++top] = i;
  }
  top = 0;
  st[top] = 0;
  for (int i = n; i >= 2; --i) {
    while (top && val[st[top]] <= val[i]) --top;
    if (top)
      nxt[i] = st[top];
    else
      nxt[i] = n + 1;
    st[++top] = i;
  }
  build(1, 1, n);
  long long maxn = 0;
  for (int i = 1; i <= n; ++i) maxn = max(maxn, a - c[i]);
  for (int i = 2; i <= n; ++i) {
    int l = lst[i], r = nxt[i] - 1;
    long long ret = 0;
    if (l <= (i - 1)) ret += max(0ll, query(1, 1, n, l, i - 1).rmax);
    if ((i + 1) <= r) ret += max(0ll, query(1, 1, n, i + 1, r).lmax);
    ret = ret + a - c[i] - val[i];
    maxn = max(maxn, ret);
  }
  printf("%lld\n", maxn);
  return 0;
}
