#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
vector<int> diag[2 * N], anti[2 * N];
int guess[N];
int n, m;
map<pair<int, int>, int> mpup;
int goup(pair<int, int> pos) {
  auto it = mpup.find(pos);
  if (it != mpup.end()) return it->second;
  int x = pos.first, y = pos.second;
  if (x == m + 1) return mpup[pos] = y;
  auto it2 = lower_bound(diag[x - y + N].begin(), diag[x - y + N].end(), x);
  if (it2 == diag[x - y + N].end()) return mpup[pos] = n;
  int nx = *it2, ny = (*it2) - x + y;
  if (nx == x)
    return mpup[pos] = goup({x + 1, y});
  else
    return mpup[pos] = goup({nx, ny});
}
map<pair<int, int>, int> mpdown;
int godown(pair<int, int> pos) {
  auto it = mpdown.find(pos);
  if (it != mpdown.end()) return it->second;
  int x = pos.first, y = pos.second;
  if (x == m + 1) return mpdown[pos] = y;
  auto it2 = lower_bound(anti[x + y].begin(), anti[x + y].end(), x);
  if (it2 == anti[x + y].end()) return mpdown[pos] = 1;
  int nx = *it2, ny = x + y - (*it2);
  if (nx == x)
    return mpdown[pos] = godown({x + 1, y});
  else
    return mpdown[pos] = godown({nx, ny});
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; i <= m; i++) {
    cin >> guess[i];
    int x = i - 1, y = guess[i] - 1;
    diag[x - y + N].push_back(x);
    x = i - 1, y = guess[i] + 1;
    anti[x + y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    int x = m + 1, y = i;
    diag[x - y + N].push_back(x);
    anti[x + y].push_back(x);
  }
  for (int i = 0; i < 2 * N; i++) {
    sort(diag[i].begin(), diag[i].end());
    sort(anti[i].begin(), anti[i].end());
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int a = goup({0, i});
    int b = godown({0, i});
    ans += a - b + 1;
  }
  cout << ans << endl;
}
