#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
int L[3 * N] = {0}, R[3 * N] = {0}, a[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  if (n == 1) {
    puts("0");
    return 0;
  }
  for (int i = m; i >= 1; i--) {
    L[i + a[i] + N] = L[N + a[i] + i + 1] + 1;
    R[a[i] - i + N] = R[N + a[i] - i - 1] + 1;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long mn = max(1, i - m - 1 + L[i + N]);
    long long mx = min(n, i + m + 1 - R[i + N]);
    ans += mx - mn + 1;
  }
  printf("%lld\n", ans);
  return 0;
}
