//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

#define all(x) begin(x), end(x)
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
vector<ll> a;

void solve() {
    int n, k;
    cin >> n >> k;
    a.resize(n);
    for (auto &x: a) cin >> x;
    vector<ll> now;
    ll ma=a[0];
    for (int i=0; i<n-1; ++i){
        ma = max(ma, a[i]);
    }
    cout << ma + a.back() + n;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t = 1;
//    cin >> t;
    while (t--) solve(), cout << '\n';
    return 0;
}