#include <bits/stdc++.h>
using namespace std;
long long a[100005], dif1[100005], dif2[100005], m, n;
int main() {
  long long mx, p, s;
  cin >> n >> m;
  n++;
  for (int i = 2; i <= n; i++) cin >> a[i];
  a[1] = 0;
  n++;
  a[n] = m;
  p = 0;
  for (int i = 2; i <= n; i += 2) {
    dif1[i] = p + (a[i] - a[i - 1]);
    p = dif1[i];
  }
  mx = max(dif1[n], dif1[n - 1]);
  p = 0;
  for (int i = 3; i <= n; i += 2) {
    dif2[i] = p + (a[i] - a[i - 1]);
    p = dif2[i];
  }
  for (int i = 1; i < n; i++) {
    if (i % 2 == 0 && a[i + 1] - 1 != a[i]) {
      s = dif1[i] + (a[i + 1] - a[i] - 1) + max(dif2[n], dif2[n - 1]) -
          dif2[i + 1];
      mx = max(mx, s);
    }
  }
  cout << mx << "\n";
  return 0;
}
