#include <bits/stdc++.h>
using namespace std;
int N, M;
unsigned long long a[(int)1e6 + 7], ans, on[(int)1e6 + 7], off[(int)1e6 + 7];
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> M;
  a[0] = 0;
  N++;
  for (int i = 1; i < N; i++) cin >> a[i];
  a[N] = M;
  N++;
  for (int i = 0; i < N; i++) {
    if (i % 2) {
      on[i] += a[i] - a[i - 1];
    }
    on[i] += on[i - 1];
  }
  for (int i = N - 1; i >= 0; i--) {
    if (i % 2 && i + 1 < N) {
      off[i] = a[i + 1] - a[i];
    }
    off[i] += off[i + 1];
  }
  ans = on[N - 1];
  for (int i = 0; i < N - 1; i++) {
    ans = max(ans, on[i] + off[i + 1] + a[i + 1] - a[i] - 1);
  }
  cout << ans;
  return 0;
}
