#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, L;
  cin >> N >> L;
  vector<long long> Hash(N + 7, 0), E(N + 2);
  E[0] = 0;
  for (int i = 1; i <= N; i++) cin >> E[i];
  E[N + 1] = L;
  int i = N + 1;
  while (i > 0) {
    Hash[i] = E[i] - E[i - 1] + Hash[i + 2];
    i--;
  }
  vector<long long> Sub(N + 2, 0);
  Sub[1] = E[1] - E[0];
  for (int i = 2; i < N + 2; i++) {
    Sub[i] = Sub[i - 2] + E[i] - E[i - 1];
  }
  long long Ans = Hash[1];
  for (int i = 1; i < N + 2; i++) {
    if (i == 1) {
      if (E[i] != E[i - 1] + 1) {
        if (Ans < E[i] - 1 - E[i - 1] + Hash[i + 1])
          Ans = E[i] - 1 - E[i - 1] + Hash[i + 1];
      }
    } else {
      if (E[i] != E[i - 1] + 1) {
        if (i & 1) {
          if (Ans < E[i] - 1 - E[i - 1] + Hash[i + 1] + Sub[i - 2])
            Ans = E[i] - 1 - E[i - 1] + Hash[i + 1] + Sub[i - 2];
        } else {
          if (Ans < E[i] - 1 - E[i - 1] + Hash[i + 2] + Sub[i - 1]) {
            Ans = E[i] - 1 - E[i - 1];
            Ans = Ans + Sub[i - 1];
            Ans = Ans + Hash[i + 2];
          }
        }
      }
    }
  }
  cout << Ans;
}
