#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int res = 0, c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  do {
    res = (res * 10) + (c ^ 48);
  } while (c = getchar(), c >= '0' && c <= '9');
  return res;
}
int s[100010], l[200010], r_buf[200020];
auto r = r_buf + 100010;
int main() {
  int N = read(), M = read();
  if (N == 1) return puts("0"), 0;
  for (int i = 1; i <= M; i++) {
    s[i] = read();
  }
  M++;
  for (int i = 1; i <= N; i++) {
    l[i] = 1, r[i] = 1;
  }
  for (int i = 1; i <= M; i++) {
    if (s[i] != 1) {
      l[s[i] + i + 1] += l[s[i] + i];
      l[s[i] + i] = 0;
      l[i + 1] += l[i];
      l[i] = 0;
    } else {
      l[i + 2] += l[i] + l[i + 1];
      l[i] = l[i + 1] = 0;
    }
    if (s[i] != N) {
      r[s[i] - i - 1] += r[s[i] - i];
      r[s[i] - i] = 0;
      r[N - i] += r[N - i + 1];
      r[N - i + 1] = 0;
    } else {
      r[N - i - 1] += r[N - i] + r[N - i + 1];
      r[N - i] = r[N - i + 1] = 0;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= N; i++) {
    ans += 1ll * r[i - M] * i;
    ans -= 1ll * l[i + M] * i;
  }
  cout << ans + N;
  return 0;
}
