#include int main(void){ int N,M,A[51]={},Mn[51]={},i,j,temp=0; scanf("%d %d",&N,&M); for(i=1;i<=N;i++){ A[i]=i; } for(j=1;j<=M;j++){ scanf("%d",&Mn[j]); temp=A[Mn[j]]; for(i=Mn[j];i>1;i--){ A[i]=A[i-1]; } A[1]=temp; //for(i=1;i<=N;i++){途中経過 //printf("A[%d]=%d\n",i,A[i]); //} } printf("%d\n",A[1]); return 0; }