#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const long long MOD = 1e9 + 7;
const int OO = 1e9;
const int N = 1e5 + 5;
int a[N];
long long con[N], cof[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  a[n + 1] = k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n + 1; ++i) {
    if (i % 2 == 0) {
      cof[i] += (a[i] - a[i - 1]);
    } else {
      con[i] += (a[i] - a[i - 1]);
    }
    cof[i] += cof[i - 1];
    con[i] += con[i - 1];
  }
  long long ans = con[n + 1];
  for (int i = 1; i <= n + 1; ++i) {
    long long of = cof[n + 1] - cof[i];
    long long tmp = con[i - 1] + of;
    tmp += (a[i] - a[i - 1] - 1);
    ans = max(ans, tmp);
  }
  cout << ans;
}
