#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 2;
long long a[N];
long long s[N];
long long rmq[N][20];
long long get(long long l, long long r) {
  long long k = log2(r - l + 1);
  return min(rmq[l][k], rmq[r - (1 << k) + 1][k]);
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, C;
  cin >> n >> C;
  long long ans = 0;
  for (long long i = 1; i <= n; ++i) {
    long long x;
    cin >> a[i] >> x;
    s[i] = s[i - 1] + C - x;
    ans = max(ans, C - x);
    rmq[i][0] = s[i];
  }
  for (long long i = 1; i < n; ++i) a[i] = a[i + 1] - a[i];
  for (long long i = 0; i < 18; ++i)
    for (long long j = 0; j + (2 << i) - 1 <= n; ++j)
      rmq[j][i + 1] = min(rmq[j][i], rmq[j + (1 << i)][i]);
  stack<long long> st;
  multiset<long long> ms;
  ms.insert(1e18);
  for (long long i = 1; i < n; ++i) {
    long long R = i - 1;
    while (st.size() && a[st.top()] <= a[i]) {
      long long L = st.top();
      if (L < R) ms.erase(ms.find(get(L, R - 1) + a[R] * a[R]));
      R = L;
      st.pop();
    }
    long long L = st.size() ? st.top() : 0;
    if (L < R) ms.erase(ms.find(get(L, R - 1) + a[R] * a[R]));
    ms.insert(get(L, i - 1) + a[i] * a[i]);
    ans = max(ans, s[i + 1] - *ms.begin());
    st.push(i);
  }
  cout << ans << endl;
}
