#include <bits/stdc++.h>
template <class T>
inline bool cmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
inline bool cmin(T& a, const T& b) {
  return a > b ? a = b, 1 : 0;
}
using namespace std;
const int N = 3e5 + 5, M = 1e5;
int n, m, a[N], L[N], R[N];
long long Ans;
int main() {
  scanf("%d%d", &n, &m);
  if (n == 1) return puts("0"), 0;
  for (register int i = 1, I = m + 1; i < I; ++i) scanf("%d", a + i);
  for (register int i = m, I = 1 - 1; i > I; --i) {
    L[a[i] + i + M] = L[a[i] + i + 1 + M] + 1;
    R[a[i] - i + M] = R[a[i] - i - 1 + M] + 1;
  }
  for (register int i = 1, I = n + 1; i < I; ++i)
    Ans += min(n, i + (m + 1 - R[i + M])) - max(1, i - (m + 1 - L[i + M])) + 1;
  printf("%lld", Ans);
  return 0;
}
