#include <bits/stdc++.h>
using namespace std;
int n, m;
const int MAXN = 100005;
long long a[MAXN], prel[MAXN], pren[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  a[n + 1] = m;
  for (int i = 1; i <= n + 1; i++) {
    if (i <= n) cin >> a[i];
    prel[i] = prel[i - 1];
    pren[i] = pren[i - 1];
    if (i % 2 == 1)
      prel[i] += a[i] - a[i - 1];
    else
      pren[i] += a[i] - a[i - 1];
  }
  long long ans = prel[n + 1];
  for (int i = 1; i <= n + 1; i++) {
    if ((a[i] != a[i - 1] + 1) || (a[i + 1] != a[i] + 1 && i != n + 1)) {
      if (i % 2 == 1)
        ans = max(ans, prel[i] - 1 + pren[n + 1] - pren[i]);
      else
        ans = max(ans, prel[i] + 1 + pren[n + 1] - pren[i]);
    }
  }
  cout << ans << "\n";
  return 0;
}
