Program Coop;
Var
        M1,M2,M3,M4:set of byte;
        s,o:int64;
        n,i,j,k:longint;
        f:boolean;
function isin(x:longint): boolean;
var
        y:byte;
begin
        y:=x mod 256;
        if x<256 then isin:=(y in M1)
        else if x<512 then isin:=(y in M2)
        else if x<768 then isin:=(y in M3)
        else isin:=(y in M4);
end;
Begin
        Read(N);
        Read(K);
        M1:=[];
        M2:=[];
        M3:=[];
        M4:=[];
        for i:=1 to K do
        begin
                Read(s);
                if s<256 then M1:=M1+[s]
                else if s<512 then M2:=M2+[s-256]
                else if s<768 then M3:=M3+[s-512]
                else M4:=M4+[s-768];
        end;
        i:=2;
        j:=N;
        s:=0;
        while ((i<>0)and(j>0)) do
        begin
                if not(isin(j)) then begin
                        s:=s+j;
                        dec(i);
                end;
                dec(j);
        end;
        o:=0;
        while s<>0 do
        begin
                j:=s-1;
                f:=true;
                while ((f)and(j>=(s div 2))) do
                begin
                        if (not(isin(j)))and(not(isin(s-j))) then begin
                                inc(o);
                                f:=false;
                        end;
                        dec(j);
                end;
                dec(s);
        end;
        Write(o);
End.
