#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> a(100005);
long long maxi[100005], mini[100005];
long long X[100005], Y[100005];
unordered_map<long long, vector<long long> > mxpos, mnpos;
long long MX(long long P) {
  if (X[P] != -1) return X[P];
  long long num = a[P] - 2 - P;
  long long posi =
      upper_bound(mxpos[num].begin(), mxpos[num].end(), P) - mxpos[num].begin();
  if (posi == mxpos[num].size()) return X[P] = a[P] + m - P - 1;
  return X[P] = MX(mxpos[num][posi]);
}
long long MN(long long P) {
  if (Y[P] != -1) return Y[P];
  long long num = a[P] + 2 + P;
  long long posi =
      upper_bound(mnpos[num].begin(), mnpos[num].end(), P) - mnpos[num].begin();
  if (posi == mnpos[num].size()) return Y[P] = a[P] + 1 - m + P;
  return Y[P] = MN(mnpos[num][posi]);
}
signed main() {
  cin >> n >> m;
  bool we = 0;
  for (long long i = 0; i < m; i++) {
    cin >> a[i];
    if (a[i] == 1) we = 1;
    X[i] = Y[i] = -1;
    mxpos[a[i] - 1 - i].push_back(i);
    mnpos[a[i] + 1 + i].push_back(i);
  }
  for (long long i = 0; i < m; i++) {
    MX(i);
    MN(i);
  }
  for (long long i = 1; i <= n; i++) {
    if (mnpos[i].size() == 0)
      mini[i - 1] = max(1LL, i - m - 1);
    else
      mini[i - 1] = max(Y[mnpos[i][0]], i - m - 1);
    if (mxpos[i].size() == 0)
      maxi[i - 1] = min(n, i + m + 1);
    else
      maxi[i - 1] = min(i + m + 1, X[mxpos[i][0]]);
    mini[i - 1] = max(1LL, mini[i - 1]);
    maxi[i - 1] = min(n, maxi[i - 1]);
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    ans += maxi[i - 1] - mini[i - 1] + 1;
  }
  if (n == 1) {
    ans = 1 - we;
  }
  cout << ans << '\n';
}
