#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 5;
int n, m;
int a[maxN];
int f[maxN];
void ReadInput() {
  cin >> n >> m;
  f[0] = a[0] = 0;
  a[n + 1] = m;
  for (int i = 1; i <= n + 1; i++) {
    if (i <= n) cin >> a[i];
    f[i] = i % 2 == 0 ? f[i - 1] : f[i - 1] + a[i] - a[i - 1];
  }
}
void Solve() {
  int res = f[n + 1];
  for (int i = 0; i <= n; i++) {
    if (a[i + 1] - a[i] < 2) continue;
    res = max(res, f[i] + m - a[i] - (f[n + 1] - f[i]) - 1);
  }
  cout << res;
}
int main() {
  ReadInput();
  Solve();
}
