#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long solve(vector<long long> v) {
  for (long long i = 0; i < m; i++) {
    v[i] -= i + 1;
  }
  map<long long, long long> loss;
  for (long long i = m - 1; i >= 0; i--) {
    loss[v[i]] = loss[v[i] - 1] + 1;
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    long long rt = min(i + m + 1 - loss[i], n);
    ans += rt - i + 1;
  }
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  vector<long long> v(m);
  for (long long i = 0; i < m; i++) {
    cin >> v[i];
  }
  long long ans = solve(v) - n;
  for (long long i = 0; i < m; i++) {
    v[i] = n - v[i] + 1;
  }
  ans += solve(v);
  cout << ans << '\n';
  return 0;
}
