#include <bits/stdc++.h>
using namespace std;
long long read();
void write(long long x);
long long n, a[100010], on[100010], off[100010];
int main() {
  long long i, ans;
  n = read();
  a[n + 1] = read();
  for (i = 1; i <= n; ++i) {
    a[i] = read();
  }
  for (i = 1; i <= n + 1; ++i) {
    if (i & 1) {
      on[i] = on[i - 1] + a[i] - a[i - 1];
      off[i] = off[i - 1];
    } else {
      off[i] = off[i - 1] + a[i] - a[i - 1];
      on[i] = on[i - 1];
    }
  }
  ans = on[n + 1];
  for (i = 0; i <= n; ++i) {
    if (a[i] + 1 < a[i + 1]) {
      ans = max(ans, on[i] + a[i + 1] - a[i] - 1 + off[n + 1] - off[i + 1]);
    }
  }
  cout << ans;
  return 0;
}
long long read() {
  char c;
  long long out = 0, f = 1;
  for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
    ;
  if (c == '-') {
    f = -1;
    c = getchar();
  }
  for (; c >= '0' && c <= '9'; c = getchar()) {
    out = out * 10 + c - '0';
  }
  return out * f;
}
void write(long long x) {
  if (x < 0) {
    putchar('-');
    write(-x);
    return;
  }
  if (x > 9) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
}
