#include <bits/stdc++.h>
using namespace std;
int read() {
  bool f = 0;
  int x = 0;
  char c = getchar();
  while (c < '0' || '9' < c) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while ('0' <= c && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return !f ? x : -x;
}
map<int, int> cnt;
int a[100000 + 5], L[100000 + 5], R[100000 + 5];
int main() {
  int n = read(), m = read();
  for (int i = 1; i <= m; i++) a[i] = read();
  if (n == 1) {
    puts("0");
    return 0;
  }
  for (int i = m; i >= 1; i--) cnt[a[i] - i] = cnt[a[i] - i - 1] + 1;
  for (int i = 1; i <= n; i++) R[i] = min(i + m + 1 - cnt[i], n);
  cnt.clear();
  for (int i = m; i >= 1; i--) cnt[a[i] + i] = cnt[a[i] + i + 1] + 1;
  for (int i = 1; i <= n; i++) L[i] = max(i - m - 1 + cnt[i], 1);
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans += R[i] - L[i] + 1;
  printf("%lld\n", ans);
  return 0;
}
