#include <bits/stdc++.h>
using namespace std;
long long l[300069], r[300069];
int n, m, o[100069];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < m; i++) {
    cin >> o[i];
    o[i]--;
  }
  reverse(o, o + m);
  for (int i = -m - 1; i < m + n + 1; i++) {
    l[i + m + 1] = r[i + m + 1] = max(0, min(i, n - 1));
  }
  for (int i = 0; i < m; i++) {
    l[o[i] - (i + 1) + m + 1] = l[o[i] - i + m + 1];
    r[o[i] + (i + 1) + m + 1] = r[o[i] + i + m + 1];
  }
  long long ans = 0ll;
  for (int i = 0; i < n; i++) {
    ans += r[i + (m + 1) + m + 1] - l[i - (m + 1) + m + 1] + 1ll;
  }
  cout << ans << endl;
  return 0;
}
