#include <bits/stdc++.h>
using namespace std;
long long a[100005], n;
vector<long long> p[2];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  cin >> a[n + 1];
  p[0].push_back(0);
  p[1].push_back(0);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n + 1; ++i)
    p[i % 2].push_back(p[i % 2].back() + a[i] - a[i - 1]);
  long long ans = p[1].back();
  for (int i = 1; i <= n + 1; ++i) {
    if (i % 2) {
      ans =
          max(ans, p[0].back() - p[0][(i + 1) / 2 - 1] + p[1][(i + 1) / 2] - 1);
    }
  }
  cout << ans;
}
