#include <bits/stdc++.h>
using namespace std;
map<int, vector<int> > lobs, robs;
map<pair<int, int>, int> lmem, rmem;
int ledg(int x, int y) {
  pair<int, int> k = {x, y};
  if (!lmem.count(k)) {
    auto it = lower_bound(begin(lobs[x + 1]), end(lobs[x + 1]), y);
    lmem[k] = it == end(lobs[x + 1]) ? x + 1 : ledg(x + 1, *it);
  }
  return lmem[k];
}
int redg(int x, int y) {
  pair<int, int> k = {x, y};
  if (!rmem.count(k)) {
    auto it = lower_bound(begin(robs[x - 1]), end(robs[x - 1]), y);
    rmem[k] = it == end(robs[x - 1]) ? x - 1 : redg(x - 1, *it);
  }
  return rmem[k];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, m;
  cin >> n >> m;
  if (n == 1) {
    cout << "0\n";
    return 0;
  }
  vector<int> a(m);
  for (int& x : a) cin >> x;
  for (int i = 0; i < m; i++) {
    int x = a[i] - 1;
    lobs[x + i].push_back(i);
    robs[x - i].push_back(i);
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int l = max(0, ledg(i - 2, -2) - m);
    int r = min(n - 1, redg(i + 2, -2) + m);
    ans += r - l + 1;
  }
  cout << ans << '\n';
}
