#include <bits/stdc++.h>
using namespace std;
const int v = 200000;
int fr[400005], bc[400005], arr[200005], N, M;
long long ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> N >> M;
  if (N == 1) {
    cout << "0\n";
    return 0;
  }
  for (int i = 1; i <= M; i++) {
    cin >> arr[i];
    arr[i] -= i;
  }
  for (int i = M; i > 0; i--) {
    fr[arr[i] + v] = max(fr[arr[i] + v], fr[arr[i] + v - 1] + 1);
  }
  for (int i = 1; i <= N; i++) {
    ans += min(N - i + 1, M - fr[i + v] + 2);
  }
  for (int i = 1; i <= M; i++) {
    arr[i] += i;
    arr[i] = N - arr[i] + 1;
    arr[i] -= i;
  }
  for (int i = M; i > 0; i--) {
    bc[arr[i] + v] = max(bc[arr[i] + v], bc[arr[i] + v - 1] + 1);
  }
  for (int i = 1; i <= N; i++) {
    ans += min(N - i + 1, M - bc[i + v] + 2);
    ans--;
  }
  cout << ans << "\n";
}
