#include <stdio.h>
void reverse(int a[],int l,int h){
	int temp;
	while(l<h){
		temp=a[l];
		a[l]=a[h];
		a[h]=temp;
		l++;h--;
		}
}
int main(){
int n,k,a[1000],x;
while(scanf("%d%d",&n,&k)!=EOF){
	if(n==0)return 0;
	for(int i=1;i<=n;i++)
		a[i]=i;
	while(k--){
		scanf("%d",&x);
		reverse(a,1,x);
		reverse(a,x+1,n);
		reverse(a,1,n);
		reverse(a,1,n/2);
	}
	printf("%d",a[1]);
	for(int i=2;i<=n;i++)
		printf(" %d",a[i]);
	printf("\n");
}
	return 0;
}