// 做法显示时间过长...套用循环太多了...40%通过
var arr1 = readline().split(' ').map(Number);
var n = arr1[0];
var m = arr1[1];
var arr2 = readline().split(' ').map(Number);
var index = 0;
var result = [arr2[0]];
while (result.length < n) {
arr2.forEach(function(v) {
if (result.length == 1) {
for (var i = 1; i < result[0]; i++) {
result[result.length] = v;
}
} else {
for (var i = 0; i < result[index]; i++) {
result[result.length] = v;
}
}
index++;
})
//console.log('last:',index,result);
}
result = result.slice(0, n);
result.forEach(function(v) {
print(v)
})