#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> arr(m);
  for (long long& i : arr) cin >> i;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  map<long long, long long> left;
  map<long long, long long> right;
  for (long long i = 0; i < n; ++i) {
    left[i + 1] = 1;
    right[i + 1] = 1;
  }
  for (long long i = 0; i < m; ++i) {
    left[arr[i] + i + 2] += left[arr[i] + i + 1];
    left[arr[i] + i + 1] = 0;
    right[arr[i] - i - 2] += right[arr[i] - i - 1];
    right[arr[i] - i - 1] = 0;
  }
  long long ans = 0;
  for (auto [i, j] : right) {
    ans += j * min(n, i + m + 1ll);
  }
  for (auto [i, j] : left) {
    ans -= j * (max(1ll, i - m - 1ll) - 1ll);
  }
  cout << ans;
}
