#include <bits/stdc++.h>
using namespace std;
int a[100005], on[100005], off[100005];
int sum = 0;
int main() {
  int n, m;
  memset(on, 0, sizeof(on));
  memset(off, 0, sizeof(off));
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  a[n + 1] = m;
  a[0] = 0;
  int c1, c2;
  if (n % 2)
    c1 = c2 = (n + 1) / 2;
  else
    c1 = n / 2 + 1, c2 = n / 2;
  int k1, k2;
  k1 = c1, k2 = c2;
  for (int i = n; i >= 0; i--) {
    if (i % 2 == 0)
      on[k1] = on[k1 + 1] + (a[i + 1] - a[i]), k1--;
    else
      off[k2] = off[k2 + 1] + (a[i + 1] - a[i]), k2--;
  }
  sum = on[1];
  int ma;
  ma = 0;
  for (int i = 1; i <= c2; i++) {
    ma = max(ma, off[i] - on[i + 1]);
  }
  if (ma != 0) sum = sum + (ma - 1);
  cout << sum << endl;
  return 0;
}
