#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m;
int a[N], prf[N];
int res = 0;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  a[n + 1] = m;
  for (int i = 0; i <= n; ++i) {
    if (i) prf[i] = prf[i - 1];
    if (!(i & 1)) prf[i] += a[i + 1] - a[i];
  }
  res = prf[n];
  for (int i = 0; i <= n; ++i)
    if (a[i] + 1 < a[i + 1]) {
      int tmp = 0;
      if (i) tmp = prf[i - 1];
      tmp += a[i + 1] - a[i] - 1 + m - a[i + 1] - prf[n] + prf[i];
      res = max(res, tmp);
    }
  cout << res;
}
