#include <bits/stdc++.h>
using namespace std;
set<int> S;
set<int>::iterator it;
pair<int, int> diff[300000 + 1];
long long rmq[2][18 + 1][300000 + 1];
long long profit[300000 + 1];
int two[300000 + 1];
int d[300000 + 1];
int c[300000 + 1];
int N, A;
void Build() {
  int i, j, l;
  for (i = 2; i <= 300000; i++) two[i] = two[i / 2] + 1;
  for (i = 1; i <= N; i++) rmq[0][0][i] = rmq[1][0][i] = profit[i];
  for (l = 0; l <= 1; l++)
    for (i = 1; (1 << i) <= N; i++)
      for (j = 1; j <= N - (1 << i) + 1; j++) {
        rmq[l][i][j] = rmq[l][i - 1][j];
        if (l == 0 && rmq[l][i][j] > rmq[l][i - 1][j + (1 << i - 1)])
          rmq[l][i][j] = rmq[l][i - 1][j + (1 << i - 1)];
        if (l == 1 && rmq[l][i][j] < rmq[l][i - 1][j + (1 << i - 1)])
          rmq[l][i][j] = rmq[l][i - 1][j + (1 << i - 1)];
      }
}
long long getSegment(int first, int second, int l) {
  int k = two[second - first + 1];
  int is_zero = 0;
  long long aux;
  if (first == 0) is_zero = 1, first++;
  if (l == 0)
    if (rmq[l][k][first] > rmq[l][k][second + 1 - (1 << k)])
      aux = rmq[l][k][second + 1 - (1 << k)];
    else
      aux = rmq[l][k][first];
  if (l == 1)
    if (rmq[l][k][first] < rmq[l][k][second + 1 - (1 << k)])
      aux = rmq[l][k][second + 1 - (1 << k)];
    else
      aux = rmq[l][k][first];
  if (l == 0 && is_zero == 1) aux = min(aux, 0LL);
  if (l == 1 && is_zero == 1) aux = max(aux, 0LL);
  return aux;
}
long long Solve(int i) {
  int st, dr;
  long long temp;
  it = S.lower_bound(diff[i].second);
  dr = *it;
  --it;
  st = *it;
  temp = getSegment(diff[i].second + 1, dr, 1) -
         getSegment(st, diff[i].second, 0) -
         (1LL * diff[i].first * diff[i].first);
  return temp;
}
int main() {
  int i, j, k;
  long long res = 0;
  cin >> N >> A;
  for (i = 1; i <= N; i++) cin >> d[i] >> c[i];
  for (i = 1; i <= N; i++) res = max(res, 0LL + A - c[i]);
  for (i = 1; i <= N; i++) profit[i] = profit[i - 1] + A - c[i];
  Build();
  for (i = 1; i < N; i++) diff[i] = {d[i + 1] - d[i], i};
  sort(diff + 1, diff + N);
  reverse(diff + 1, diff + N);
  S.insert(0);
  S.insert(N);
  for (i = 1; i < N; i = j) {
    for (j = i; j < N && diff[i].first == diff[j].first; j++)
      res = max(res, Solve(j));
    for (k = i; k < j; k++) S.insert(diff[k].second);
  }
  cout << res;
  return 0;
}
