#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
vector<int> lis[3 * N];
int ar[N], ar1[N], dp[3 * N];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, i, j, k, l, m;
  long long ans = 0;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    cin >> ar[i];
  }
  for (i = 1; i <= m; i++) {
    ar1[i] = ar[i] + (2 * m - i);
  }
  for (i = m; i >= 1; i--) {
    lis[ar1[i]].push_back(i);
    if (lis[ar1[i] - 1].size()) {
      dp[i] = dp[lis[ar1[i] - 1].back()] + 1;
    } else {
      dp[i] = 1;
    }
  }
  for (i = 1; i <= n; i++) {
    if (lis[i + 2 * m].size()) {
      ans += min(n - i + 1, m + 1 - dp[lis[i + 2 * m].back()] + 1);
    } else {
      ans += min(n - i + 1, m + 1 + 1);
    }
  }
  for (i = 1; i <= m; i++) {
    lis[ar1[i]].clear();
    dp[i] = 0;
    ar1[i] = ar[i] + (m + i);
  }
  for (i = m; i >= 1; i--) {
    lis[ar1[i]].push_back(i);
    if (lis[ar1[i] + 1].size()) {
      dp[i] = dp[lis[ar1[i] + 1].back()] + 1;
    } else {
      dp[i] = 1;
    }
  }
  for (i = 1; i <= n; i++) {
    if (lis[i + m].size()) {
      ans += min(i, m + 1 - dp[lis[i + m].back()] + 1);
    } else {
      ans += min(i, m + 1 + 1);
    }
  }
  if (n == 1) {
    cout << 0;
    return 0;
  }
  cout << ans - n;
}
