#include <bits/stdc++.h>
using namespace std;
int a[100005], dp[200005];
int lo[100005], hi[100005];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  if (n == 1) return !printf("0\n");
  for (int i = m; i >= 1; i--) dp[a[i] + i] = dp[a[i] + i + 1] + 1;
  for (int i = 1; i <= n; i++) lo[i] = max(1, i - m + dp[i] - 1);
  memset(dp, 0, sizeof(dp));
  for (int i = m; i >= 1; i--)
    dp[a[i] - i + 100001] = dp[a[i] - 1 - i + 100001] + 1;
  for (int i = 1; i <= n; i++) hi[i] = min(n, i + m - dp[i + 100001] + 1);
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans += hi[i] - lo[i] + 1;
  printf("%lld\n", ans);
}
