#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  T sum = 0, sign = 1;
  char c = getchar();
  while (!((c) >= '0' && (c) <= '9')) {
    if (c == '-') sign = -1;
    c = getchar();
  }
  while (((c) >= '0' && (c) <= '9')) {
    sum = (sum << 1) + (sum << 3) + c - '0';
    c = getchar();
  }
  x = sum * sign;
}
template <typename T>
inline T max(T a, T b) {
  return a > b ? a : b;
}
template <typename T>
inline T min(T a, T b) {
  return a < b ? a : b;
}
const int N = 1e5 + 5;
int n, m;
int a[N], l[N * 3], r[N * 3];
inline void init() {}
inline void solve() {
  init();
  read(n), read(m);
  for (int i = 1; i <= m; ++i) {
    read(a[i]);
  }
  if (n == 1) {
    puts("0");
    return;
  }
  for (int i = m; i >= 1; --i) {
    l[a[i] + i + N] = l[a[i] + i + 1 + N] + 1;
    r[a[i] - i + N] = r[a[i] - i - 1 + N] + 1;
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += min(i + m + 1 - r[i + N], n) - max(i - m - 1 + l[i + N], 1) + 1;
  }
  printf("%lld\n", ans);
  return;
}
int test;
int main() {
  test = 1;
  for (int i = 1; i <= test; ++i) solve();
  return 0;
}
