#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int n, m;
int ob[100010];
int en[100010];
int ob2[100010];
int en2[100010];
map<int, int> M;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= int(m); i++) {
    int x;
    cin >> x;
    ob[i] = x;
    ob2[i] = n + 1 - x;
  }
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; i <= int(n); i++) M.insert(make_pair(i, 1));
  int nowadd = 0;
  for (int i = 1; i <= int(m); i++) {
    int tar = ob[i] - nowadd - 1;
    if (M.count(tar)) {
      if (M.count(tar - 1))
        M[tar - 1] += M[tar];
      else
        M.insert(make_pair(tar - 1, M[tar]));
      M[tar] = 0;
    }
    nowadd++;
  }
  nowadd++;
  int ind = 1;
  for (auto ite = M.begin(); ite != M.end(); ite++) {
    for (int j = 0; j < int(ite->second); j++) {
      en[ind] = min(n, ite->first + nowadd);
      ind++;
    }
  }
  M.clear();
  for (int i = 1; i <= int(n); i++) M.insert(make_pair(i, 1));
  nowadd = 0;
  for (int i = 1; i <= int(m); i++) {
    int tar = ob2[i] - nowadd - 1;
    if (M.count(tar)) {
      if (M.count(tar - 1))
        M[tar - 1] += M[tar];
      else
        M.insert(make_pair(tar - 1, M[tar]));
      M[tar] = 0;
    }
    nowadd++;
  }
  nowadd++;
  ind = 1;
  for (auto ite = M.begin(); ite != M.end(); ite++) {
    for (int j = 0; j < int(ite->second); j++) {
      en2[ind] = min(n, ite->first + nowadd);
      ind++;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= int(n); i++) {
    ans += (en[i] - i);
    ans += (en2[i] - i);
  }
  cout << ans + n << endl;
}
