#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 5;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);
const long long inf = 0x3f3f3f3f;
long long n, m;
long long a[maxn];
long long s1[maxn], s2[maxn];
long long sum1[maxn], sum2[maxn];
int main() {
  cin >> n >> m;
  a[1] = 0;
  for (long long i = 2; i <= n + 1; i++) scanf("%lld", &a[i]);
  a[n + 2] = m;
  n++, n++;
  long long k1 = 1, k2 = 1;
  for (long long i = 1; i < n; i += 2) {
    s1[k1++] = a[i + 1] - a[i];
  }
  for (long long i = 2; i < n; i += 2) {
    s2[k2++] = a[i + 1] - a[i];
  }
  for (long long i = 1; i < k1; i++) sum1[i] = sum1[i - 1] + s1[i];
  for (long long i = 1; i < k2; i++) sum2[i] = sum2[i - 1] + s2[i];
  long long ans = sum1[k1 - 1];
  for (long long i = 1; i < n; i++) {
    long long sum = 0;
    if ((a[i + 1] - a[i] != 1) && (i % 2 != 0)) {
      sum += sum1[i / 2] + a[i + 1] - 1 - a[i];
      long long num = n - i;
      long long nn = n;
      if (num % 2) nn--;
      sum += sum2[nn / 2] - sum2[i / 2];
    } else if (a[i + 1] - a[i] != 1 && (i % 2 == 0)) {
      sum += sum1[i / 2] + a[i + 1] - (a[i] + 1);
      long long num = n - (i + 1);
      long long nn = n;
      if (num % 2) nn--;
      sum += sum2[nn / 2] - sum2[i / 2];
    }
    ans = max(ans, sum);
  }
  printf("%lld\n", ans);
  return 0;
}
