#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long nm = max(n, m);
  long long naik[nm + 5], naikn[nm + 5], turun[nm + 5], turunn[nm + 5], x;
  naik[0] = 0;
  for (long long i = 1; i <= nm; i++) {
    naik[i] = 1;
    turun[i] = 1;
    naikn[i] = 0;
    turunn[i] = 0;
  }
  long long ans = 0;
  for (long long i = 1; i <= m; i++) {
    cin >> x;
    long long d = x;
    if (x - i < 0) {
      long long d = i - x;
      if (naikn[d] > 0) {
        naikn[d + 1] += naikn[d];
        naikn[d] = 0;
      }
    } else {
      long long d = x - i;
      if (naik[d] > 0) {
        if (d == 0) {
          naikn[1] += naik[d];
          naik[d] = 0;
        } else {
          naik[d - 1] += naik[x - i];
          naik[x - i] = 0;
        }
      }
    }
    if (x + i > n) {
      long long d = (x + i) - n;
      if (turunn[d] > 0) {
        turunn[d + 1] += turunn[d];
        turunn[d] = 0;
      }
    } else {
      long long d = x + i;
      if (d == n) {
        turunn[1] += turun[d];
        turun[d] = 0;
      } else {
        turun[d + 1] += turun[d];
        turun[d] = 0;
      }
    }
  }
  long long pt = 1;
  for (int i = nm; i >= 0; i--) {
    while (naikn[i] > 0 && i != 0) {
      if (m + 1 - i >= n)
        ans += n - pt;
      else
        ans += m + 1 - i - pt;
      naikn[i]--;
      pt++;
    }
    while (i == 0 && naik[i] > 0) {
      if (m + 1 - i >= n)
        ans += n - pt;
      else
        ans += m + 1 - i - pt;
      naik[i]--;
      pt++;
    }
  }
  for (int i = 1; i <= n; i++) {
    while (naik[i] > 0) {
      if (m + 1 + i >= n)
        ans += n - pt;
      else
        ans += m + 1 + i - pt;
      naik[i]--;
      pt++;
    }
  }
  pt = n;
  for (int i = nm; i >= 1; i--) {
    while (turunn[i] > 0) {
      if (n + i - m - 1 <= 1)
        ans += pt - 1;
      else
        ans += pt - (n + i - m - 1);
      turunn[i]--;
      pt--;
    }
  }
  for (int i = n; i >= 1; i--) {
    while (turun[i] > 0) {
      if (i - m - 1 <= 1)
        ans += pt - 1;
      else
        ans += pt - (i - m - 1);
      turun[i]--;
      pt--;
    }
  }
  if (n != 1)
    cout << ans + n << endl;
  else
    cout << ans << endl;
}
