#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

void solve() {
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    ll res[2]{0, 0};
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        res[i % 2] = max(res[i % 2], a[i] + i / 2 + 1);
    }
    cout << res[0] + res[1];
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    
    solve();
}