#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100005];
map<int, int> l, r;
int main() {
  scanf("%d%d", &n, &m);
  if (n == 1) return printf("0\n"), 0;
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  for (int i = m; i >= 1; i--) {
    l[a[i] + i] = l[a[i] + i + 1] + 1;
    r[a[i] - i] = r[a[i] - i - 1] + 1;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long nl = max(1, i - m - 1 + l[i]);
    long long nr = min(n, i + m + 1 - r[i]);
    ans += (nr - nl + 1);
  }
  printf("%lld\n", ans);
}
