#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000 + 17;
int n, m, a[MAXN], L[MAXN], R[MAXN], parL[MAXN], parR[MAXN];
long long ans;
void set_rootR(int v, int x) {
  if (parR[v] == v) {
    parR[v] = x;
    return;
  }
  set_rootR(parR[v], x);
  parR[v] = x;
}
void set_rootL(int v, int x) {
  if (parL[v] == v) {
    parL[v] = x;
    return;
  }
  set_rootL(parL[v], x);
  parL[v] = x;
}
int find_rootR(int v) {
  if (parR[v] == v) return v;
  parR[v] = find_rootR(parR[v]);
  return parR[v];
}
int find_rootL(int v) {
  if (parL[v] == v) return v;
  parL[v] = find_rootL(parL[v]);
  return parL[v];
}
void addEdgeR(int v, int u) {
  int root = find_rootR(u);
  set_rootR(v, root);
}
void addEdgeL(int v, int u) {
  int root = find_rootL(u);
  set_rootL(v, root);
}
int indL(int v, int i) {
  int pL = find_rootL(v);
  return max(pL - (L[pL] + i), 1);
}
int indR(int v, int i) {
  int pR = find_rootR(v);
  return min(pR + (R[pR] + i), n);
}
int bsL(int v, int x) {
  int l = v, r = n + 1;
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    int ind = indL(mid, x);
    if (ind <= v)
      l = mid;
    else
      r = mid;
  }
  if (indL(l, x) == v)
    return l;
  else
    return -1;
}
int bsR(int v, int x) {
  int l = 1, r = v + 1;
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    int ind = indR(mid, x);
    if (ind > v)
      r = mid;
    else
      l = mid;
  }
  if (indR(l, x) == v)
    return l;
  else
    return -1;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> a[i];
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; i <= n + 2; i++) parL[i] = parR[i] = i;
  for (int i = 1; i <= m; i++) {
    int tL1, tL2, tR1, tR2;
    tL1 = bsL(a[i] + 1, i - 1);
    tL2 = bsL(a[i] + 2, i - 1);
    tR1 = bsR(a[i] - 1, i - 1);
    tR2 = bsR(a[i] - 2, i - 1);
    if (a[i] > 2 && tR1 != -1 && tR2 != -1) addEdgeR(tR2, tR1);
    if (a[i] < n - 1 && tL1 != -1 && tL2 != -1) addEdgeL(tL2, tL1);
    if (a[i] > 1 && tR1 != -1) {
      int t = find_rootR(tR1);
      R[t]--;
    }
    if (a[i] < n && tL1 != -1) {
      int t = find_rootL(tL1);
      L[t]--;
    }
  }
  for (int i = 1; i <= n; i++) {
    int l = indL(i, m + 1), r = indR(i, m + 1);
    ans += r - l + 1;
  }
  cout << ans << endl;
  return 0;
}
