#include <bits/stdc++.h>
using namespace std;
int N, M, a[100000 + 5], answer;
void solution1() {
  bool onoff = 1;
  int onTime = 0, offTime = 0;
  for (int i = 0; i < N + 1; i++) {
    if (onoff) {
    } else {
      offTime += a[i + 1] - a[i];
    }
    onoff = !onoff;
  }
  answer = M - offTime;
  for (int i = 1; i < N + 1; i += 2) {
    onTime += a[i] - a[i - 1];
    if (a[i] - a[i - 1] > 1) {
      if (0)
        cout << "put at " << a[i] - 1 << " " << onTime << " " << offTime
             << endl;
      int light = onTime - 1 + offTime;
      answer = max(answer, light);
    }
    if (a[i + 1] - a[i] > 1) {
      if (0)
        cout << "put at " << a[i] + 1 << " " << onTime << " " << offTime
             << endl;
      int light = onTime + offTime - 1;
      answer = max(answer, light);
    }
    offTime -= a[i + 1] - a[i];
  }
  cout << answer << endl;
}
int main() {
  cin >> N >> M;
  a[0] = 0;
  for (int i = 1; i < N + 1; i++) cin >> a[i];
  a[N + 1] = M;
  solution1();
  return 0;
}
