#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int last[2 * N], cnt[2 * N];
int l[N], r[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m), c(m);
  if (n == 1) {
    cout << 0;
    return 0;
  }
  for (int i = 0; i < (int)(m); i++) {
    cin >> a[i];
    --a[i];
    b[i] = n - i + a[i];
    c[i] = i + a[i];
  }
  memset(last, -1, sizeof last);
  for (int i = (int)(m)-1; i >= ((int)0); i--) {
    cnt[b[i]] = last[b[i] - 1] == -1 ? 1 : 1 + cnt[b[i] - 1];
    last[b[i]] = i;
  }
  for (int i = 0; i < (int)(n); i++) r[i] = min(n - 1, i + m - cnt[n + i + 1]);
  memset(last, -1, sizeof last);
  memset(cnt, 0, sizeof cnt);
  for (int i = (int)(m)-1; i >= ((int)0); i--) {
    cnt[c[i]] = last[c[i] + 1] == -1 ? 1 : 1 + cnt[c[i] + 1];
    last[c[i]] = i;
  }
  for (int i = (int)(1); i < ((int)n); i++) l[i] = max(0, i - m + cnt[i - 1]);
  for (int i = 0; i < (int)(n); i++) {
    l[i] = max(0, l[i] - 1);
    r[i] = min(n - 1, r[i] + 1);
  }
  long long int ans = 0;
  for (int i = 0; i < (int)(n); i++) ans += r[i] - l[i] + 1;
  cout << ans << endl;
  return 0;
}
