#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long int m;
  cin >> n >> m;
  long long int a[n + 2];
  a[0] = 0;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  a[n + 1] = m;
  long long int sum1 = 0, sum = 0;
  for (int i = 1; i < n + 1; i = i + 2) {
    sum1 += a[i + 1] - a[i];
  }
  long long int max = -1;
  for (int i = 0; i < n + 1; ++i) {
    if (i % 2 == 0) {
      if (sum + a[i + 1] - a[i] - 1 + sum1 > max)
        max = sum + a[i + 1] - a[i] - 1 + sum1;
      sum += a[i + 1] - a[i];
    } else {
      sum1 -= a[i + 1] - a[i];
      if (sum + a[i + 1] - a[i] - 1 + sum1 > max)
        max = sum + a[i + 1] - a[i] - 1 + sum1;
    }
  }
  if (sum > max) max = sum;
  cout << max << "\n";
}
