#include<bits/stdc++.h>
using namespace std;
struct X{
int id;
long long x;
bool operator<(const X &B) const{
return x<B.x;
}
bool operator>(const X &B) const{
return x>B.x;
}
};
priority_queue<X,vector<X>,greater<X> > hp;
int n,m;
X a[5010];
vector<int> b[5010];
int main(){
cin>>n>>m;
for(int i=1;i<=5010;i++){
a[i].id=0;
a[i].x=0;
}
for(int i=1;i<=m;i++){
int x;
scanf("%d",&x);
a[i]=(X){i,x};
}
int r=1;
int cnt=1;
while(r<=m){
if(r<=n){
hp.push((X){r,a[r].x});
b[r].push_back(a[r].id);
}else{
X g=hp.top();
hp.pop();
int w=g.id;
long long v=g.x;
v+=a[r].x;
b[w].push_back(r);
hp.push((X){w,v});
}
r++;
cnt++;
}
for(int i=1;i<cnt;i++){
for(int j=0;j<b[i].size();j++){
cout<<b[i][j]<<"0";
}
cout<<endl;
}
if(n>m){
for(int i=1;i<=(n-m);i++){
cout<<"0"<<endl;
}
}
return 0;
}
```c++