#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5, M = 1e5;
int L[N], R[N], a[N];
signed main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  if (n == 1) return cout << 0, 0;
  for (int i = 1; i <= m; ++i) cin >> a[i];
  for (int i = m; i >= 1; --i)
    R[a[i] - i + M] = R[a[i] - i - 1 + M] + 1,
                 L[a[i] + i + M] = L[a[i] + i + 1 + M] + 1;
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    int l = max(1, i - m - 1 + L[i + M]), r = min(n, i + m + 1 - R[i + M]);
    ans += r - l + 1;
  }
  cout << ans;
}
