func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   const int N = 1e5 + 10;   int n, m, a[N];   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.setf(ios::fixed), cout.precision(9);     cin >> n >> m;     for (int i = 1; i <= n; ++i) cin >> a[i];     a[n + 1] = m;     vector<int> pfs(n + 2, 0), pos(n + 2, 0);     for (int i = 1; i <= n + 1; ++i) {       if (i & 1) {         if (i - 2 >= 0) pfs[i] = pfs[i - 2];         pfs[i] += a[i] - a[i - 1];       } else {         pfs[i] = pfs[i - 1];       }     }     if (n & 1) {       for (int i = n; i >= 0; --i) {         if ((n - i) & 1) {           pos[i] = pos[i + 1];         } else {           if (i + 2 <= n) pos[i] = pos[i + 2];           pos[i] += a[i + 1] - a[i];         }       }     } else {       for (int i = n; i >= 0; --i) {         if ((n - i) & 1) {           if (i + 2 <= n) pos[i] = pos[i + 2];           pos[i] += a[i + 1] - a[i];         } else {           pos[i] = pos[i + 1];         }       }     }     int ans = pfs[n + 1];     for (int i = 0; i <= n + 1; ++i) {       if (a[i] - 1 > 0 and a[i] - 1 != a[i - 1]) {         int now_ans;         if (i & 1) {           now_ans = pfs[i] - 1 + pos[i];         } else {           now_ans = pfs[i - 1] + 1 + pos[i];         }         ans = max(ans, now_ans);       }       if (a[i] + 1 < m and a[i] + 1 != a[i + 1]) {         int now_ans;         if (i & 1) {           now_ans = pfs[i] + a[i + 1] - a[i] - 1 + pos[i + 1];         } else {           now_ans = pfs[i] + 1 + pos[i + 1];         }         ans = max(ans, now_ans);       }     }     cout << ans <<   n ;   }   