#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7;
vector<int> p[N];
int a[N], L[N], R[N], n, m;
void unite(int x1, int x2) {
  if (p[x2].size() > p[x1].size()) {
    for (auto x : p[x1]) p[x2].push_back(x);
    swap(p[x1], p[x2]);
    p[x2].clear();
  } else {
    for (auto x : p[x2]) p[x1].push_back(x);
    p[x2].clear();
  }
}
void gaor() {
  for (int i = 0; i <= n + m; i++) p[i].clear();
  for (int i = 1; i <= n; i++) p[i + m].push_back(i);
  for (int i = 1; i <= m; i++) {
    int y = a[i] + m - i;
    if (p[y].size() > 0) {
      unite(y - 1, y);
    }
  }
  for (int i = 1; i <= n + m; i++) {
    for (int x : p[i]) {
      R[x] = min(i, n);
    }
  }
}
void gaol() {
  for (int i = 0; i <= n + m; i++) p[i].clear();
  for (int i = 1; i <= n; i++) p[i].push_back(i);
  for (int i = 1; i <= m; i++) {
    int y = a[i] + i;
    if (p[y].size() > 0) {
      unite(y + 1, y);
    }
  }
  for (int i = 1; i <= n + m; i++) {
    for (int x : p[i]) {
      L[x] = max(i - m, 1);
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  if (n == 1) return 0 * printf("0");
  m++;
  gaor();
  gaol();
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += R[i] - L[i] + 1;
  }
  printf("%lld", ans);
  return 0;
}
