#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  long long a[100000];
  long long mx[200100] = {0};
  long long mn[200100] = {0};
  for (long long i = 0; i < n; i++) {
    long long num = i + 1;
    mx[num + 1 + m]++;
    mn[100010 + num - 1 - m]++;
  }
  for (long long i = 0; i < m; i++) {
    long long num = i + 1;
    cin >> a[i];
    mx[a[i] + m - i - 1] += mx[a[i] + m - i];
    mx[a[i] + m - i] = 0;
    mn[a[i] - (m - i) + 100011] += mn[a[i] - (m - i) + 100010];
    mn[a[i] - (m - i) + 100010] = 0;
  }
  long long ans = 0;
  ans += n;
  for (long long i = 0; i < n + m + 2; i++) {
    ans += min(i, n) * (mx[i]);
    ans -= max((long long)1, (n - i - 1)) * mn[n - i - 1 + 100010];
  }
  if (n == 1 && m != 0)
    cout << 0 << "\n";
  else
    cout << ans << "\n";
  return 0;
}
