#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int M = 1e5 + 5;
int a[N], dp1[N], dp2[N];
int main() {
  int n, m;
  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--) {
    dp1[a[i] + i + M] = dp1[a[i] + i + 1 + M] + 1;
    dp2[a[i] - i + M] = dp2[a[i] - i - 1 + M] + 1;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int r = min(n, i + m + 1 - dp2[i + M]);
    int l = max(1, i - m - 1 + dp1[i + M]);
    ans += r - l + 1;
  }
  printf("%lld", ans);
}
