var
n,c,i,j,k,tmp:longint;
pearl:array [1..100000] of longint;
begin
assign(input,'ppairing.in');
reset(input);
assign(output,'ppairing.out');
rewrite(output);
readln(n,c);
for i:=1 to c do
begin
readln(tmp);
for j:=k+1 to k+tmp do pearl[j]:=i;
inc(k,tmp);
end;
for i:=1 to n div 2 do
writeln(pearl[i],' ',pearl[i+n div 2]);
close(input);
close(output);
end.