#include <bits/stdc++.h>
using namespace std;
typedef struct {
  long long x, y;
} Node;
Node e[110 * 2];
long long dp[110][110];
long long s1[110 * 2], s2[110 * 2];
int main() {
  int n, i, j, k;
  long long m, ans, t;
  scanf("%d%lld", &n, &m);
  e[0].x = 0;
  e[0].y = 0;
  e[n + 1].x = m;
  e[n + 1].y = 0;
  for (i = 1; i <= n; i++) scanf("%lld%lld", &e[i].x, &e[i].y);
  s1[0] = 0;
  for (i = 1; i <= n; i++) s1[i] = s1[i - 1] + e[i].y - (e[i].x - e[i - 1].x);
  s2[n + 1] = 0;
  for (i = n; i >= 1; i--) s2[i] = s2[i + 1] + e[i].y - (e[i + 1].x - e[i].x);
  memset(dp, 0, sizeof(dp));
  ans = 0;
  for (i = 1; i <= n; i++) {
    dp[i][0] = s1[i];
    dp[0][i] = s2[n - i + 1];
    for (j = 0; j <= i; j++) {
      dp[i - j][j] =
          max(dp[i - j][j], s1[i - j] + s2[n - j + 1] -
                                min(e[i - j].x, e[n + 1].x - e[n - j + 1].x));
      ans = max(ans, dp[i - j][j]);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
