#include <iostream> #include <vector> using namespace std; int main(int argc, char* argv[]) { int N,M; cin>>N>>M; vector<int> Val; int i; for (i=1;i<=N;i++){ Val.push_back(i); } int A; for (i=0;i<M;i++){ cin>>A; int v=Val[A-1]; Val.erase(Val.begin()+A-1); Val.insert(Val.begin(),v); } cout<<Val[0]<<endl; return 0; }