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