#include <bits/stdc++.h>

using namespace std;

const int MX = 200000;

int a[MX], l;
long long s[MX + 1];

long long f(int n) {
	s[0] = 0;
	for (int i = 0; i < n; i++) s[i + 1] = s[i] + a[i];
	
	long long res = 0;
	for (int f = 0; f < n; f++) {
		int N = n - f, p = (N + 1) / 2, q = N / 2;
		long long ans = (s[f + q] - s[f]) * 2 + s[f + p] - s[f + q];
		ans -= 2 * (s[n] - s[n - p + 1]) + s[n - p + 1] - s[n - q];
		ans += l * (N - 1ll);
		
		/*
		long long ans = 0;
		for (int i = f, j = n - 1, p = 0; i <= j; i++, j--) {
			ans += a[i] - p;
			p = a[i];
			if (i != j) {
				ans += p - (a[j] - l);
				p = a[j] - l;
			}
		}
		*/
		
		res = max(res, ans);
	}
	
	return res;
}

int main() {
	int n;
	ignore = scanf("%d %d", &l, &n);
	for (int i = 0; i < n; i++) ignore = scanf("%d", a + i);
	
	long long ans = f(n);
	
	reverse(a, a + n);
	for (int i = 0; i < n; i++) a[i] = l - a[i];
	
	ans = max(f(n), ans);

	printf("%lld\n", ans);
	
	return 0;
}
