program prison;
var p,i,t,min:word; q:integer;
a:array[0..1001]of 0..2;
function tot(s,t:word):word;
var i,w:word;
begin
w:=0;
for i:=s to t do if a[i]>0 then inc(w);
exit(w);
end;
procedure find(s,t:word);
var i,j,k1,k2,k:word;
begin
i:=s; j:=t; k1:=(t+s)div 2+1; k2:=k1-1;
if (s+t)mod 2 =0 then k:=k2 else k:=k1;
while a[i]=1 do inc(i); while a[j]=1 do dec(j);
while a[k1]=1 do inc(k1); while a[k2]=1 do dec(k2);
if abs(k1-k)<abs(k2-k) then k:=k1 else k:=k2;
if (a[k]=0)and(k=k1) then k:=k2;
if (a[k]=0)and(k=k2) then k:=k1;
a[k]:=0; dec(q); min:=min+tot(s,t);
if (i=j)or(q<=0) then exit;
if (k>s)and(q>0) then find(s,k-1);
if (k<t)and(q>0) then find(k+1,t);
end;
begin
assign(input,'prison.in'); reset(input);
assign(output,'prison.out'); rewrite(output);
fillchar(a,sizeof(a),1);
readln(p,q);
for i:=1 to q do begin read(t); a[t]:=2; end;
min:=0;
find(1,p);
writeln(min);
close(input); close(output);
end.