func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 100010;   inline long long read() {     long long p = 0;     long long f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       p = p * 10 + ch -  0 ;       ch = getchar();     }     return p * f;   }   long long a[N];   long long R[N << 1], L[N << 1];   int main() {     long long n = read();     long long m = read();     if (n == 1) {       printf( 0 n );       return 0;     }     for (long long i = 1; i <= m; i++) a[i] = read();     long long ans = 0;     long long l = 1;     long long r = n;     for (long long i = 1; i <= n; i++) R[i] = i;     for (long long i = 1; i <= m; i++) {       long long x = a[i];       l++;       r++;       R[r] = R[r - 1];       R[l + x - 1] = R[l + x - 2];     }     l++;     r++;     R[r] = R[r - 1];     for (long long i = l; i <= r; i++) ans += R[i] + 1;     l = m + 2;     r = n + m + 1;     for (long long i = 1; i <= n; i++) L[i + m + 1] = i;     for (long long i = 1; i <= m; i++) {       long long x = a[i];       l--;       r--;       L[l] = L[l + 1];       L[l + x - 1] = L[l + x];     }     l--;     r--;     L[l] = L[l + 1];     for (long long i = l; i <= r; i++) ans -= L[i];     return printf( %lld n , ans), 0;   }   