#include <bits/stdc++.h>
using namespace std;
const int N = 400010;
const int T = 100010;
int a[N];
int L[N], R[N];
int main() {
  int n, m;
  cin >> n >> m;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; i <= m; i++) cin >> a[i];
  for (int i = m; i >= 1; i--) {
    L[a[i] + i + T] = L[a[i] + i + T + 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[T + i]);
    int r = min(n, i + (m + 1) - R[T + i]);
    ans += (r - l + 1);
  }
  cout << ans << endl;
}
