#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T abs(T t) {
  return t < 0 ? -t : t;
}
const long long modn = 1000000007;
inline long long mod(long long x) { return x % modn; }
const int MAXN = 412345;
int n, m, k;
int s[MAXN];
int p[MAXN], sz[MAXN], ans[MAXN];
int ind[MAXN];
int raiz(int u) {
  if (p[u] == u) return u;
  return p[u] = raiz(p[u]);
}
void join(int i, int j) {
  if (i == -1 || j == -1) return;
  i = raiz(i);
  j = raiz(j);
  if (i == j) return;
  if (sz[i] > sz[j]) swap(i, j);
  p[i] = j;
  sz[j] += sz[i];
}
int main() {
  scanf("%d%d", &n, &m);
  if (n == 1) {
    puts("0");
    return 0;
  }
  for (int a = 0; a < m; a++) {
    scanf("%d", s + a);
    s[a]--;
  }
  memset(ind, -1, sizeof(ind));
  for (int a = 0; a < n; a++) ind[a] = a;
  for (int a = 0; a <= m + n + 3; a++) {
    p[a] = a;
    sz[a] = 1;
  }
  for (int a = 0; a < m; a++) {
    int xb = s[a] + a + 1;
    if (ind[xb] == -1) continue;
    join(ind[xb], ind[xb + 1]);
    ind[xb + 1] = raiz(ind[xb]);
    ind[xb] = -1;
  }
  long long ans = 0;
  for (int a = 0; a <= m + n + 3; a++) {
    if (ind[a] != -1) {
      int l = max(0, a - m - 1);
      ans -= ((long long)sz[raiz(ind[a])]) * (l - 1);
    }
  }
  for (int a = 0; a < m; a++) {
    s[a] = n - 1 - s[a];
  }
  memset(ind, -1, sizeof(ind));
  for (int a = 0; a < n; a++) ind[a] = a;
  for (int a = 0; a <= m + n + 3; a++) {
    p[a] = a;
    sz[a] = 1;
  }
  for (int a = 0; a < m; a++) {
    int xb = s[a] + a + 1;
    if (ind[xb] == -1) continue;
    join(ind[xb], ind[xb + 1]);
    ind[xb + 1] = raiz(ind[xb]);
    ind[xb] = -1;
  }
  for (int a = 0; a <= m + n + 3; a++) {
    if (ind[a] != -1) {
      int r = n - 1 - max(0, a - m - 1);
      ans += ((long long)sz[raiz(ind[a])]) * r;
    }
  }
  printf("%lld\n", ans);
}
