#include <bits/stdc++.h>
using namespace std;
int N, M, i, j, X;
int v[100005], ANS;
int A[100005], B[100005];
int main() {
  cin >> N >> M;
  for (i = 1; i <= N; i++) cin >> v[i];
  v[++N] = M;
  for (i = 1; i <= N; i++) {
    A[i] = A[i - 1];
    if (i % 2 == 1) A[i] += v[i] - v[i - 1];
  }
  for (i = N - 1; i >= 0; i--) {
    B[i] = B[i + 1];
    if (i % 2 == 1) B[i] += v[i + 1] - v[i];
  }
  ANS = A[N];
  for (i = 0; i < N; i++) {
    X = A[i];
    X += B[i + 1];
    X += v[i + 1] - v[i] - 1;
    ANS = max(ANS, X);
  }
  cout << ANS;
  return 0;
}
