#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, m;
  cin >> n >> m;
  long long ans = 0;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  long long s = 1e7, BEGIN = 5 * 1e6;
  vector<long long> l(s), r(s);
  for (long long i = 0; i < s; i++) {
    l[i] = i - m - 1;
    r[i] = i + m + 1;
  }
  vector<long long> a(m);
  for (long long i = 0; i < m; i++) {
    cin >> a[i];
  }
  reverse(a.begin(), a.end());
  for (long long i = 0; i < m; i++) {
    long long R = (m - i) + a[i] + BEGIN;
    long long L = a[i] - (m - i) + BEGIN;
    l[R] = l[R + 1];
    r[L] = r[L - 1];
  }
  for (long long i = 1; i <= n; i++) {
    ans += min(n, r[i + BEGIN] - BEGIN) - max(1ll, l[i + BEGIN] - BEGIN) + 1;
  }
  cout << ans;
}
