#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5, re0 = 1e5;
int n, m;
long long ans;
int a[maxn], L_b[maxn], R_b[maxn];
int main() {
  scanf("%d%d", &n, &m);
  if (n == 1) {
    printf("0");
    return 0;
  }
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  for (int i = m; i >= 1; i--) {
    R_b[re0 + a[i] - i] = R_b[re0 + a[i] - i - 1] + 1;
    L_b[re0 + a[i] + i] = L_b[re0 + a[i] + i + 1] + 1;
  }
  for (int i = 1; i <= n; i++)
    ans +=
        ((i + m + 1 - R_b[re0 + i]) > n ? n : (i + m + 1 - R_b[re0 + i])) -
        ((i - (m + 1) + L_b[re0 + i]) < 1 ? 1 : (i - (m + 1) + L_b[re0 + i])) +
        1;
  printf("%I64d\n", ans);
  return 0;
}
