#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int INF = 1 << 30;
const int mod = 1000000009;
int lowbit(int x) { return x & (-x); }
int fast_power(int a, int b) {
  int x;
  for (x = 1; b; b >>= 1) {
    if (b & 1) x = 1ll * x * a % mod;
    a = 1ll * a * a % mod;
  }
  return x % mod;
}
int a[MAXN], sum[MAXN];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  a[n + 1] = m;
  for (int i = n; i >= 0; i--) {
    sum[i] = sum[i + 2] + a[i + 1] - a[i];
  }
  int ans = sum[0], res = 0;
  for (int i = 1; i <= n; i++) {
    if (i & 1) {
      res += a[i] - a[i - 1];
      ans = max(ans, res - 1 + sum[i]);
    }
  }
  printf("%d\n", ans);
  return 0;
}
