#include <bits/stdc++.h>
using namespace std;
template <class t>
inline t read(t &x) {
  bool f = 0;
  char c = getchar();
  x = 0;
  while (!isdigit(c)) f |= c == '-', c = getchar();
  while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  if (f) x = -x;
  return x;
}
template <class t>
inline void write(t x) {
  if (x < 0)
    putchar('-'), write(-x);
  else {
    if (x > 9) write(x / 10);
    putchar('0' + x % 10);
  }
}
const int N = 1e5 + 5, C = 1e5;
int n, m, a[N], L[N * 5], R[N * 5];
signed main() {
  read(n);
  read(m);
  if (n == 1) return write(0), 0;
  for (int i = 1; i <= m; i++) read(a[i]);
  for (int i = m; i; i--) {
    L[a[i] + i + C] = L[a[i] + i + 1 + C] + 1;
    R[a[i] - i + C] = R[a[i] - i - 1 + C] + 1;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int l = max(1, i - m - 1 + L[i + C]);
    int r = min(n, i + m + 1 - R[i + C]);
    ans += r - l + 1;
  }
  write(ans);
}
