#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
long long lazy[300009 << 2], s[300009 << 2], par[300009], val[300009];
const long long B = 2e18;
int d[300009], c[300009];
void shift(int nd) {
  long long& ret = lazy[nd];
  if (!ret) return;
  lazy[nd << 1] += ret;
  s[nd << 1] += ret;
  lazy[nd << 1 | 1] += ret;
  s[nd << 1 | 1] += ret;
  ret = 0;
}
void inc(int l, int r, long long v, int nd, int x, int y) {
  if (l > y or x > r) return;
  if (l <= x and y <= r) {
    lazy[nd] += v;
    s[nd] += v;
    return;
  }
  shift(nd);
  int mid = (x + y) >> 1;
  inc(l, r, v, nd << 1, x, mid);
  inc(l, r, v, nd << 1 | 1, mid + 1, y);
  s[nd] = max(s[nd << 1], s[nd << 1 | 1]);
}
void upd(int p, long long v, int nd, int x, int y) {
  if (x == y) {
    s[nd] = v;
    return;
  }
  shift(nd);
  int mid = (x + y) >> 1;
  if (p <= mid)
    upd(p, v, nd << 1, x, mid);
  else
    upd(p, v, nd << 1 | 1, mid + 1, y);
  s[nd] = max(s[nd << 1], s[nd << 1 | 1]);
}
int main() {
  int n, a;
  scanf("%d%d", &n, &a);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", d + i, c + i),
        par[i] = par[i - 1] + c[i],
        val[i] = (d[i] - d[i - 1]) * 1LL * (d[i] - d[i - 1]);
  for (int i = 1; i <= n * 4; i++) s[i] = -B;
  long long ans = 0, res = 0;
  val[1] = B;
  stack<int> st;
  for (int i = 1; i <= n; i++) {
    if (i > 1) umax(res, val[i]);
    umax(ans, i * 1LL * a - par[i] - res);
    int last = i - 1;
    long long tmp = 0;
    while (!st.empty()) {
      inc(st.top(), last, -val[i] + tmp, 1, 1, n);
      if (val[st.top()] >= val[i]) break;
      last = st.top() - 1;
      tmp = val[st.top()];
      st.pop();
    }
    st.push(i);
    umax(ans, i * 1LL * a - par[i] + s[1]);
    upd(i + 1, -i * 1LL * a + par[i], 1, 1, n);
  }
  printf("%lld\n", ans);
  return 0;
}
