#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, m;
  cin >> n >> m;
  vector<vector<long long>> a(n + 1);
  vector<long long> h(1e5 + 7);
  vector<long long> p;
  for (long long i = 1; i <= m; i++) {
    long long q;
    cin >> q;
    a[q].push_back(i);
    if (!h[q]) p.push_back(q);
    h[q]++;
  }
  if (n == 1) {
    if (m)
      cout << "0";
    else
      cout << "1";
    return 0;
  }
  sort(p.begin(), p.end());
  vector<long long> ans1(n + 2);
  vector<long long> ans2(n + 2);
  p.push_back(n + 1);
  for (long long i = 1; i <= p[0]; i++) {
    ans1[i] = min(i, m + 2);
  }
  vector<long long> dp(1e6 + 7);
  for (long long i = 0; i < p.size() - 1; i++) {
    reverse(a[p[i]].begin(), a[p[i]].end());
    for (long long j = 0; j < a[p[i]].size(); j++) {
      dp[p[i] + a[p[i]][j]] = dp[p[i] + a[p[i]][j] + 1] + 1;
    }
    for (long long j = p[i] + 1; j <= p[i + 1]; j++) {
      ans1[j] = min(j, m + 2 - dp[j]);
    }
  }
  map<long long, long long> dp2;
  p.pop_back();
  p.push_back(0);
  sort(p.rbegin(), p.rend());
  for (long long i = n; i >= p[0]; i--) {
    ans2[i] = min(m + 2, n - i + 1);
  }
  for (long long i = 0; i < p.size() - 1; i++) {
    for (long long j = 0; j < a[p[i]].size(); j++) {
      dp2[p[i] - a[p[i]][j]] = dp2[p[i] - a[p[i]][j] - 1] + 1;
    }
    for (long long j = p[i] - 1; j >= p[i + 1]; j--) {
      ans2[j] = min(m + 2 - dp2[j], n - j + 1);
    }
  }
  long long ans = 0;
  for (long long i = 1; i < n + 1; i++) {
    ans += ans1[i] + ans2[i];
  }
  cout << ans - n;
}
