#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 3e5 + 20;
const long long mod = 998244353;
const bool debug = false;
template <class T>
inline void add(T &x, long long y, long long mod) {
  x += y;
  if (x >= mod) x -= mod;
}
template <class T>
inline void add(T &x, long long y, long long z, long long mod) {
  x = y + z;
  if (x >= mod) x -= mod;
}
inline long long qpow(long long x, long long y, long long mod) {
  x %= mod;
  long long ret = 1;
  while (y) {
    if (y & 1) ret = ret * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ret;
}
inline long long qmul(long long x, long long y, long long mod) {
  return ((x * y - (long long)((long double)x * y / mod) * mod) + mod) % mod;
}
inline long long gcd(long long x, long long y) { return x ? gcd(y % x, x) : y; }
inline long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
int n, m, a[N], r[N], l[N];
map<int, int> mp;
void solve() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) scanf("%d", &a[i]);
  if (n == 1) {
    puts("0");
    return;
  }
  for (int i = 1; i <= n; ++i) mp[i] = 1;
  for (int i = 1; i <= m; ++i) {
    int tp = a[i] - i;
    mp[tp - 1] += mp[tp];
    mp[tp] = 0;
  }
  int now = 1;
  for (auto it : mp)
    while (it.second--) r[now++] = min(it.first + m + 1, n);
  mp.clear();
  for (int i = 1; i <= n; ++i) mp[i] = 1;
  for (int i = 1; i <= m; ++i) {
    int tp = a[i] + i;
    mp[tp + 1] += mp[tp];
    mp[tp] = 0;
  }
  now = 1;
  for (auto it : mp)
    while (it.second--) l[now++] = max(it.first - m - 1, 1);
  long long ans = 0;
  for (int i = 1; i <= n; ++i) ans += r[i] - l[i] + 1;
  printf("%lld\n", ans);
}
int main() {
  solve();
  return 0;
}
