#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int a[N], temp[N], l[N], r[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  if (n == 1) {
    printf("0\n");
    return 0;
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; ++i) {
    temp[i] = a[i] + i;
  }
  unordered_map<int, int> u;
  for (int i = m; i > 0; --i) {
    u[temp[i]] = u[temp[i] + 1] + 1;
  }
  for (int i = 1; i <= n; ++i) {
    l[i] = max(1, i + u[i] - m - 1);
  }
  for (int i = 1; i <= m; ++i) {
    temp[i] = a[i] - i;
  }
  u.clear();
  for (int i = m; i > 0; --i) {
    u[temp[i]] = u[temp[i] - 1] + 1;
  }
  for (int i = 1; i <= n; ++i) {
    r[i] = min(n, i - u[i] + m + 1);
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += r[i] - l[i] + 1;
  }
  cout << ans << endl;
  return 0;
}
