#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 69;
int n, m, a[maxn];
long long sum[maxn], res, cnt;
void nhap() {
  for (int i = 1; i <= n; i++) cin >> a[i];
}
void out() {
  for (int i = 1; i <= n + 1; i++) {
    if (a[i - 1] + 1 == a[i]) {
      if (i % 2) cnt++;
      continue;
    }
    if (i % 2) {
      res = max(res, cnt + a[i] - a[i - 1] - 1 + sum[i]);
      cnt += a[i] - a[i - 1];
    } else
      res = max(res, cnt + a[i] - a[i - 1] - 1 + sum[i + 1]);
  }
}
void add() {
  for (int i = n; i >= 0; i--) sum[i] = sum[i + 2] + a[i + 1] - a[i];
  res = sum[0];
}
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  nhap();
  a[n + 1] = m;
  add();
  out();
  cout << res << endl;
  return 0;
}
