#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  ll n, m;
  cin >> n >> m;
  std::vector<int> a(n + 2);
  n = n + 2;
  a[0] = 0;
  a[n - 1] = m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  ll v[n][2];
  v[n - 1][0] = 0;
  v[n - 1][1] = 0;
  for (int i = n - 2; i >= 0; i--) {
    v[i][0] = v[i + 1][1];
    v[i][1] = (a[i + 1] - a[i]) + v[i + 1][0];
  }
  ll ans = v[0][1];
  ll cur = 0;
  for (int i = 0; i < n - 1; i++) {
    int f;
    if (i % 2 == 0)
      f = 1;
    else
      f = 0;
    if (f == 1) {
      if (a[i + 1] - a[i] > 1) {
        ans = max(ans, cur + a[i + 1] - 1 - a[i] + v[i + 1][1]);
      }
      cur += a[i + 1] - a[i];
    } else {
      if (a[i + 1] - a[i] > 1) {
        ans = max(ans, cur + a[i + 1] - (a[i] + 1) + v[i + 1][0]);
      }
    }
  }
  cout << ans;
  return 0;
}
