#include <bits/stdc++.h>
using namespace std;
template <typename T>
T read1() {
  T t = 0;
  char k;
  bool v = 0;
  do (k = getchar()) == '-' && (v = 1);
  while ('0' > k || k > '9');
  while ('0' <= k && k <= '9')
    t = (t << 3) + (t << 1) + (k ^ '0'), k = getchar();
  return v ? -t : t;
}
int s;
long long a[300005], d[300005], x, sum[300005], st[3][20][300005], w[300005];
long long A(int x) { return d[x + 1] - d[x]; }
long long Get(int l, int r, int x) {
  int o = w[r - l + 1], c = r - (1 << o) + 1;
  if (x == 0 || x == 2) return max(st[x][o][l], st[x][o][c]);
  return min(st[x][o][l], st[x][o][c]);
}
int main() {
  s = read1<long long>(), x = read1<long long>();
  long long ans = 0;
  for (int i = 1; i <= s; ++i)
    d[i] = read1<long long>(), ans = max(ans, a[i] = x - read1<long long>()),
    sum[i] = st[1][0][i] = st[2][0][i] = sum[i - 1] + a[i];
  for (int i = 2; i <= s + 1; ++i) w[i] = w[i >> 1] + 1;
  for (int i = 1; i < s; ++i) st[0][0][i] = A(i);
  for (int i = s; i--;)
    for (int j = 1; i + (1 << j) - 1 <= s; ++j)
      i + (1 << j) - 1 != s &&i &&
          (st[0][j][i] = max(st[0][j - 1][i], st[0][j - 1][i + (1 << j - 1)])),
          st[1][j][i] = min(st[1][j - 1][i], st[1][j - 1][i + (1 << j - 1)]),
          st[2][j][i] = max(st[2][j - 1][i], st[2][j - 1][i + (1 << j - 1)]);
  for (int i = 1; i < s; ++i) {
    int l = 1, r = i, tans, mid, ans1;
    while (l <= r)
      if (Get(mid = l + r >> 1, i, 0) <= A(i))
        tans = mid, r = mid - 1;
      else
        l = mid + 1;
    l = i, r = s - 1;
    while (l <= r)
      if (Get(i, mid = l + r >> 1, 0) <= A(i))
        ans1 = l = mid + 1;
      else
        r = mid - 1;
    ans = max(Get(i + 1, ans1, 2) - Get(tans - 1, i - 1, 1) - A(i) * A(i), ans);
  }
  cout << ans;
  return 0;
}
