#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int xl[190000]={0};
inline int mn(){
freopen("ppairing.in","r",stdin);
freopen("ppairing.out","w",stdout);
register int n,c;
register int cl;
register int f=0;
scanf("%d%d",&n,&c);
for(register int i=1;i<=c;++i){
scanf("%d",&cl);
for(int j=f+1;j<=f+cl;++j){
xl[j]=i;
}
f+=cl;
}
for(register int i=1;i<=n/2;++i){
printf("%d ",xl[i]);
printf("%d\n",xl[i+n/2]);
}
return 0;
}
int ll=mn();
int main(){;}