#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int inf = 1e9;
int mod = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int a[m + 1];
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
  }
  if (n == 1) {
    cout << "0\n";
    return 0;
  }
  map<int, set<int>> F, B;
  for (int i = 1; i <= m; i++) {
    int x = a[i] - i;
    F[x].insert(i);
    x = a[i] + i;
    B[x].insert(i);
  }
  int id[m + 1];
  for (int i = 1; i <= m; i++) {
    id[i] = i;
  }
  sort(id + 1, id + m + 1, [&](int x, int y) {
    if (a[x] == a[y]) {
      return x < y;
    }
    return a[x] < a[y];
  });
  int dp[m + 1];
  for (int i = m; i > 0; i--) {
    int x = a[id[i]] - id[i] - 1;
    auto it = F[x].upper_bound(id[i]);
    if (it == F[x].end()) {
      dp[id[i]] = m - id[i] + 1;
    } else {
      int y = *(it);
      dp[id[i]] = a[y] - a[id[i]] + dp[y];
    }
  }
  long long int ans = 0;
  int L[n + 1], R[n + 1];
  for (int i = 1; i <= n; i++) {
    if (F[i].empty()) {
      R[i] = min(i + m + 1, n);
    } else {
      int x = *(F[i].begin());
      R[i] = min(a[x] - 1 + dp[x], n);
    }
  }
  F.clear();
  sort(id + 1, id + m + 1, [&](int x, int y) {
    if (a[x] == a[y]) {
      return x > y;
    }
    return a[x] < a[y];
  });
  for (int i = 1; i <= m; i++) {
    int x = a[id[i]] + id[i] + 1;
    auto it = B[x].upper_bound(id[i]);
    if (it == B[x].end()) {
      dp[id[i]] = m - id[i] + 1;
    } else {
      int y = *(it);
      dp[id[i]] = a[id[i]] - a[y] + dp[y];
    }
  }
  for (int i = 1; i <= n; i++) {
    if (B[i].empty()) {
      L[i] = max(1, i - m - 1);
    } else {
      int x = *(B[i].begin());
      L[i] = max(1, a[x] + 1 - dp[x]);
    }
  }
  for (int i = 1; i <= n; i++) {
    ans += R[i] - L[i] + 1;
  }
  cout << ans << "\n";
  return 0;
}
