#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#define maxn 1010
using namespace std;
int n, k;
void Shift(int *a,int pos)
{
int b[2*maxn];//两倍长度实现循环数组的效果
for(int i=1;i<=n;i++)
{
b[i] = a[i];
b[i + n] = a[i];
}
for(int i=pos+1;i<pos+n+1;i++)
{
a[i-pos] = b[i];
// cout<<a[i-pos]<<endl;
}
}
int main() {
while (cin >> n >> k) {
if (n == 0 && k == 0)break;
int a[maxn];
for (int i = 1; i <= n; i++) {
a[i] = i;
// cout<<a[i]<<endl;
}
int pos;
for (int i = 0; i < k; i++) {
cin >> pos;
Shift(a,pos);
if (n % 2 != 0)reverse(&a[1], &a[(n - 1) / 2] + 1);
else reverse(&a[1], &a[n / 2] + 1);
}
for (int i = 1; i < n; i++) {
cout << a[i] << " ";
}
cout << a[n] << endl;
}
}
// 64 位输出请用 printf("%lld")