#include <bits/stdc++.h>
using namespace std;
const int N(1e5 + 5);
int n, v[N], dr[N], res, curr;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  cin >> v[++n];
  for (int i = 1; i < n; ++i) cin >> v[i];
  for (int i = n - 1; i; --i) dr[i] = dr[i + 2] + (v[i + 1] - v[i]);
  for (int i = 1; i <= n; ++i) {
    if (i % 2) curr += (v[i] - v[i - 1]);
    if (v[i + 1] - v[i] != 1) {
      if (i % 2)
        res = max(res, curr + max(v[n] - v[i] - dr[i], dr[i] - 1));
      else
        res = max(res, curr + max(v[n] - v[i] - dr[i] - 1, dr[i]));
    }
  }
  cout << res;
  return 0;
}
