#include <bits/stdc++.h>
using namespace std;
template <class T>
void test(T t) {
  cout << t << endl;
}
template <class T, class T2>
void test(T t, T2 t2) {
  cout << t << " " << t2 << endl;
}
template <class T, class T2, class T3>
void test(T t, T2 t2, T3 t3) {
  cout << t << " " << t2 << " " << t3 << endl;
}
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9 + 7;
const double eps = 1e-6;
const int N = 1e5 + 10;
long long pre[N], suf[N];
long long a[N];
void work() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  a[n + 1] = m;
  pre[0] = 0;
  for (int i = 1; i <= n + 1; ++i) {
    if (i & 1) {
      pre[i] = pre[i - 1] + a[i] - a[i - 1];
    } else {
      pre[i] = pre[i - 1];
    }
  }
  suf[n + 1] = 0;
  for (int i = n; i >= 1; --i) {
    if (i & 1) {
      suf[i] = suf[i + 1] + a[i + 1] - a[i];
    } else {
      suf[i] = suf[i + 1];
    }
  }
  long long ans = pre[n + 1];
  for (int i = 1; i <= n + 1; ++i) {
    if (a[i - 1] != a[i] - 1) {
      long long temp = a[i] - 1 - a[i - 1] + pre[i - 1] + suf[i];
      ans = max(ans, temp);
    }
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  int t;
  work();
}
