#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5;
long long n, m, a[N], res, pr[N], sum;
bool f;
signed main() {
  cin >> n >> m;
  n += 2;
  for (long long i = 1; i < n - 1; ++i) cin >> a[i];
  a[n - 1] = m;
  pr[1] = a[1];
  sum = a[1];
  for (long long i = 2; i < n; ++i) {
    if (i & 1)
      pr[i] = pr[i - 1] + a[i] - a[i - 1];
    else
      pr[i] = pr[i - 1];
    sum += a[i];
  }
  res = pr[n - 1];
  for (long long i = 0; i < n - 1; ++i) {
    if (a[i] + 1 != a[i + 1]) {
      res = max(res, m - a[i + 1] + pr[i] + pr[i + 1] - pr[n - 1] - 1 +
                         a[i + 1] - a[i]);
    }
  }
  cout << res;
}
