#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int MAX = 1e5 + 5;
const long long MAX2 = 11;
const long long MOD = 1000000000;
const long long MOD2 = 1000005329;
const long long INF = 2e18;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1, 0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 2000;
long long n, m, x[MAX], y[MAX << 1], ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  if (n == 1) return cout << "0\n", 0;
  for (long long i = 1; i <= n; ++i) y[i + m] = 1;
  for (long long i = 1; i <= m; ++i) {
    cin >> x[i];
    y[x[i] + m - i - 1] += y[x[i] + m - i];
    y[x[i] + m - i] = 0;
    x[i] = n - x[i] + 1;
  }
  cerr << ">>>>>> "
       << "y[1]"
       << " -> " << y[1] << '\n';
  for (long long i = 1; i <= n + m; ++i)
    ans += (min(n + m, i + m + 1) - m) * y[i];
  memset(y, 0, sizeof y);
  for (long long i = 1; i <= n; ++i) y[i + m] = 1;
  for (long long i = 1; i <= m; ++i) {
    y[x[i] + m - i - 1] += y[x[i] + m - i];
    y[x[i] + m - i] = 0;
  }
  for (long long i = 1; i <= n + m; ++i)
    ans += (min(n + m, i + m + 1) - m) * y[i];
  cout << ans - n * n << '\n';
  return 0;
}
