#include <bits/stdc++.h>
using namespace std;
template <typename U, typename V>
void Min(U &a, const V &b) {
  if (a > b) a = b;
}
template <typename U, typename V>
void Max(U &a, const V &b) {
  if (a < b) a = b;
}
template <typename U, typename V>
void add(U &a, const V &b) {
  a = (a + b) % 1000000007;
}
template <typename U>
U gcd(U a, U b) {
  if (a == 0) return b;
  if (b == 0) return a;
  if (a >= b)
    return gcd(a % b, b);
  else
    return gcd(a, b % a);
}
int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % 1000000007;
    a = 1LL * a * a % 1000000007;
    b >>= 1;
  }
  return ans;
}
int pow(int a, int b, int c) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % c;
    a = 1LL * a * a % c;
    b >>= 1;
  }
  return ans;
}
int a[100005], r[100005];
int main() {
  int T, i, j, k, m, n, ca = 0, K;
  scanf("%d%d", &n, &m);
  for (int i = 1; i < m + 1; i++) scanf("%d", &a[i]), a[i]--;
  if (n == 1) {
    puts("0");
    return 0;
  }
  unordered_map<int, int> g;
  long long ans = n;
  auto solve = [&]() {
    g.clear();
    for (int i = m + 1 - 1; i >= 1; i--) {
      k = a[i] - i;
      k--;
      if (g.count(k))
        r[i] = r[g[k]];
      else
        r[i] = min(a[i] + m - i, n - 1);
      g[k + 1] = i;
    }
    for (int i = 0; i < n; i++) {
      if (g.count(i))
        k = r[g[i]] - i;
      else
        k = min(i + m + 1, n - 1) - i;
      ans += k;
    }
  };
  solve();
  for (int i = 1; i < m + 1; i++) a[i] = n - 1 - a[i];
  solve();
  printf("%lld\n", ans);
}
