#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v;
  v.push_back(0);
  for (int i = 0; i < n; i++) {
    int ss;
    cin >> ss;
    v.push_back(ss);
  }
  v.push_back(m);
  vector<pair<int, int>> vv;
  int yes = 0, no = 0;
  for (int i = 1; i < v.size(); i++) {
    if (i % 2 == 1) {
      yes += v[i] - v[i - 1];
      vv.push_back(make_pair(yes, no));
    } else {
      no += v[i] - v[i - 1];
      vv.push_back(make_pair(yes, no));
    }
  }
  int answer = vv[vv.size() - 1].first;
  for (int i = 0; i < v.size() - 1; i++) {
    int yes_gg = vv[vv.size() - 1].first - vv[i].first;
    int no_gg = vv[vv.size() - 1].second - vv[i].second;
    int yy = 0, nn = 0;
    if (i > 0) {
      yy = vv[i - 1].first;
      nn = vv[i - 1].second;
    }
    if (v[i + 1] - v[i] > 1) {
      answer = max(answer, yy + no_gg + v[i + 1] - v[i] - 1);
    }
  }
  cout << answer << endl;
  return 0;
}
