#include <bits/stdc++.h>
using namespace std;
long long a[100010], b[100010], x[100010], y[100010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m, ans = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  a[0] = 0;
  a[n + 1] = m;
  for (int i = 1; i <= n + 1; i++) {
    b[i] = a[i] - a[i - 1];
    if (i & 1) ans += b[i];
    x[i] = x[i - 1];
    y[i] = y[i - 1];
    if (i & 1)
      x[i] += b[i];
    else
      y[i] += b[i];
  }
  for (int i = 1; i <= n + 1; i++) {
    if (b[i] > 1) {
      ans = max(ans, x[i - 1] + y[n + 1] - y[i] + b[i] - 1);
    }
  }
  cout << ans;
  return 0;
}
