#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INF_LL = 0x3f3f3f3f3f3f3f3f;
const int N = 2e5 + 5;
int a[N];
int pa[N], siz[N], idx[N];
int Find(int x) { return x == pa[x] ? x : pa[x] = Find(x); }
void Move(int pos) {
  int pa1 = Find(idx[pos]);
  int pa2 = Find(idx[pos + 1]);
  if (pa1 && pa2) {
    assert(pa1 != pa2);
    siz[pa2] += siz[pa1];
    if (pa2) pa[pa1] = pa2;
    idx[pos] = 0;
  } else if (pa1 && !pa2) {
    idx[pos + 1] = idx[pos];
    idx[pos] = 0;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> a[i];
  if (n == 1 && m != 0) {
    cout << 0;
    return 0;
  }
  long long ans = 0;
  memset(idx, 0, sizeof(idx));
  for (int i = 1; i <= n; i++) pa[i] = i, siz[i] = 1, idx[i] = i;
  for (int i = 1; i <= m + 1; i++) {
    Move(i);
    if (i <= m) Move(a[i] + i);
  }
  for (int i = 1; i <= n; i++) ans -= 1LL * siz[Find(idx[m + i + 1])] * (i - 1);
  memset(idx, 0, sizeof(idx));
  for (int i = 1; i <= n; i++) pa[i] = i, siz[i] = 1, idx[i] = i;
  for (int i = 1; i <= m + 1; i++) {
    Move(i);
    if (i <= m) Move((n - a[i] + 1) + i);
  }
  for (int i = 1; i <= n; i++)
    ans += 1LL * siz[Find(idx[m + i + 1])] * (n - i + 1);
  cout << ans << endl;
  return 0;
}
