#include <bits/stdc++.h>
using namespace std;
const int mxn = 300001;
int n, m;
int a[mxn], l[mxn], r[mxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  if (!~-n) {
    cout << 0 << '\n';
    return 0;
  }
  for (int i = 1; i <= m; i++) cin >> a[i];
  for (int i = m; i; i--) {
    l[m + a[i] + i] = l[m + a[i] + i + 1] + 1;
    r[m + a[i] - i] = r[m + a[i] - i - 1] + 1;
  }
  long long ret = 0;
  for (int i = 1; i <= n; i++) {
    ret += min(n, i + m + 1 - r[m + i]) - max(1, i - m - 1 + l[m + i]) + 1;
  }
  cout << ret << '\n';
  return 0;
}
