#include #include #include #include #include #include #include using namespace std; int main(){ vector s; int N,M,num; cin >> N >> M; for(int i=N;i>=1;i--) s.push_back(i); while(M--){ cin >> num; s.push_back(s[N-num]); s.erase(s.end()-num); } cout << s[N-1]; return 0; }