#include <bits/stdc++.h>
using namespace std;
long long arr[100005];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, m, a, b, c = 0;
  cin >> n >> m;
  a = b = 0;
  for (long long x = 0; x < n; x++) {
    cin >> arr[x];
  }
  arr[n] = m;
  bool bit;
  for (long long x = n - 1; x >= 0; x--) {
    if ((x % 2) == 1) {
      a += arr[x + 1] - arr[x];
      if ((x == 0 && arr[x] != 1) || arr[x - 1] != arr[x] - 1)
        c = max(c, b - a - 1);
    } else {
      b += arr[x + 1] - arr[x];
      if (arr[x + 1] != arr[x] + 1) c = max(c, b - a - 1);
    }
  }
  a += arr[0];
  if (arr[1] != 1) {
    c = max(c, b - a - 1);
  }
  cout << a + c;
  return 0;
}
