// task name is Coop

#include <bits/stdc++.h>

#define ONLINE

using namespace std;

const int N = 2e4 + 5;
const int M = 1e6 + 5;

long long a[N];
pair <long long, long long> lines[M], new_lines[M];

int main()
{
    #ifdef ONLINE
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #endif // ONLINE

    int n, k;
    cin >> n >> k;
    for (int i = 0; i < k; i++) cin >> a[i];

    a[k] = 0;
    a[k + 1] = n + 1;
    k += 2;
    sort(a, a + k);

    int lines_sz = 0;
    for (int i = 1; i < k; i++)
    {
        if (a[i] == a[i - 1] + 1) continue;
        long long li = a[i - 1] + 1, ri = a[i] - 1;
        int pos_lines = 0, new_lines_sz = 0;

        for (int j = i; j < k; j++)
        {
            if (a[j] == a[j - 1] + 1) continue;
            long long l = a[j - 1] + 1 + li, r = a[j] - 1 + ri;

            while (pos_lines < lines_sz && lines[pos_lines].first < l)
            {
                if (new_lines_sz == 0 || lines[pos_lines].first > new_lines[new_lines_sz - 1].second + 1)
                    new_lines[new_lines_sz++] = lines[pos_lines++];
                else new_lines[new_lines_sz - 1].second = lines[pos_lines++].second;
            }

            if (new_lines_sz == 0 || l > new_lines[new_lines_sz - 1].second + 1)
                new_lines[new_lines_sz++] = make_pair(l, r);
            else new_lines[new_lines_sz - 1].second = r;
        }

        while (pos_lines < lines_sz)
        {
            if (new_lines_sz == 0 || lines[pos_lines].first > new_lines[new_lines_sz - 1].second + 1)
                new_lines[new_lines_sz++] = lines[pos_lines++];
            else new_lines[new_lines_sz - 1].second = lines[pos_lines++].second;
        }

        lines_sz = new_lines_sz;
        memcpy(lines, new_lines, lines_sz * sizeof(pair <long long, long long>));
    }

    long long ans = 0;
    for (int i = 0; i < lines_sz; i++) ans += lines[i].second - lines[i].first + 1;
    cout << ans;

    return 0;
}
