#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
set<long long> posDiagToJ[N], negDiagToJ[N];
map<long long, long long> memoPos[N], memoNeg[N];
long long n, m;
long long solvePos(long long i, long long j) {
  if (j == m + 1) return i;
  if (memoPos[i].count(j)) return memoPos[i][j];
  auto it = posDiagToJ[i + j].upper_bound(j);
  long long res = -1;
  if (it == posDiagToJ[i + j].end()) {
    long long temp = (m + 1) - j;
    res = max(0LL, i - temp);
  } else {
    long long blockedJ = *it;
    long long temp = blockedJ - j;
    res = solvePos(i - temp + 1, j + temp);
  }
  return memoPos[i][j] = res;
}
long long solveNeg(long long i, long long j) {
  if (j == m + 1) return i;
  if (memoNeg[i].count(j)) return memoNeg[i][j];
  auto it = negDiagToJ[j - i + n].upper_bound(j);
  long long res = -1;
  if (it == negDiagToJ[j - i + n].end()) {
    long long temp = (m + 1) - j;
    res = min(n - 1, i + temp);
  } else {
    long long temp = *it - j;
    res = solveNeg(i + temp - 1, j + temp);
  }
  return memoNeg[i][j] = res;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  for (long long j = 1; j <= m; ++j) {
    long long box;
    cin >> box;
    --box;
    posDiagToJ[j + box].insert(j);
    negDiagToJ[j - box + n].insert(j);
  }
  vector<long long> lows(n);
  vector<long long> highs(n);
  for (long long i = 0; i < n; ++i) {
    lows[i] = solvePos(i, 0);
    highs[i] = solveNeg(i, 0);
  }
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    ans += highs[i] - lows[i] + 1;
  }
  cout << ans << '\n';
}
