#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10, T = 1e5;
int a[maxn], R[maxn], L[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> a[i];
  if (n == 1) {
    cout << 0;
    return 0;
  }
  for (int i = m; i >= 1; i--) {
    L[a[i] + i] = L[a[i] + i + 1] + 1;
    R[a[i] - i + T] = R[a[i] - i - 1 + T] + 1;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int l = max(1, i - (m + 1) + L[i]);
    int r = min(n, i + (m + 1) - R[i + T]);
    ans = ans + r - l + 1;
  }
  cout << ans << '\n';
  return 0;
}
