#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) {
  return (b == 0LL ? a : gcd(b, a % b));
}
long long exp(long long a, long long b, long long m) {
  if (b == 0LL) return 1LL;
  if (b == 1LL) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1LL) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
const int N = 100100;
int a[N];
set<pair<int, int> > nxt[N + N];
int n, m;
map<pair<int, int>, int> dp;
int go(int x, int y) {
  auto it = nxt[x + y].lower_bound(pair<int, int>(x, y));
  if (it == nxt[x + y].end()) {
    return y - (m + 1 - x);
  }
  if (dp.count({it->first, it->second}))
    return dp[pair<int, int>(it->first, it->second)];
  return dp[pair<int, int>(it->first, it->second)] =
             go(it->first + 1, it->second);
}
int goR(int x, int y) {
  auto it = nxt[x - y + N].lower_bound(pair<int, int>(x, y));
  if (it == nxt[x - y + N].end()) {
    return y + (m + 1 - x);
  }
  if (dp.count(pair<int, int>(it->first, it->second)))
    return dp[pair<int, int>(it->first, it->second)];
  return dp[pair<int, int>(it->first, it->second)] =
             goR(it->first + 1, it->second);
}
int L[N], R[N];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
    nxt[a[i] + i].insert(pair<int, int>(i, a[i]));
  }
  if (n == 1) {
    cout << 0 << "\n";
    return 0;
  }
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    L[i] = max(1, go(0, i));
  }
  dp.clear();
  dp = map<pair<int, int>, int>();
  for (int i = 0; i < (N * 2); ++i) nxt[i].clear();
  for (int i = 1; i <= m; i++) {
    nxt[i - a[i] + N].insert(pair<int, int>(i, a[i]));
  }
  for (int i = 1; i <= n; i++) {
    R[i] = min(n, goR(0, i));
  }
  for (int i = 1; i <= n; i++) res += R[i] - L[i] + 1;
  cout << res << "\n";
}
