#include <cstdio>
#include <algorithm>
using namespace std;
using ll = long long;

const int MAX = 200005;

int main() {
	int L, N;
	scanf("%d %d", &L, &N);

	int p1[MAX], p2[MAX];
	for (int x, i = 1; i <= N; i++) {
		scanf("%d", &x);
		p1[i] = x;
		p2[N + 1 - i] = L - x;
	}

	ll dp1[MAX] = { L - p1[N] }, dp2[MAX] = { L - p2[N] };
	ll ans = max(L - dp1[0], L - dp2[0]);

	for (int i = 1; i < N; i++) {
		dp1[i] = dp1[i - 1] + p1[N - (i - 1) / 2] + p1[N - i / 2] - 2 * p1[N - i];
		dp2[i] = dp2[i - 1] + p2[N - (i - 1) / 2] + p2[N - i / 2] - 2 * p2[N - i];
		ans = max({ ans, (i + 1ll) * L - dp1[i], (i + 1ll) * L - dp2[i] });
	}

	printf("%lld", ans);

	return 0;
}