#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m;
int a[N], prefixsum[N];
int ans = 0;
int main() {
  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 != 0) prefixsum[i] = prefixsum[i - 1];
    if (i % 2 == 0) prefixsum[i] += a[i + 1] - a[i];
  }
  ans = prefixsum[n];
  for (int i = 0; i <= n; ++i)
    if (a[i] + 1 < a[i + 1]) {
      int tmp = 0;
      if (i) tmp = prefixsum[i - 1];
      tmp += -a[i] - 1 + m - prefixsum[n] + prefixsum[i];
      ans = max(ans, tmp);
    }
  cout << ans;
}
