#include // #include using namespace std; // using bigint = boost::multiprecision::cpp_int; template using min_priority_queue = priority_queue,greater>; random_device seed_gen; mt19937 engine(seed_gen()); int64_t get_time_ns(){ struct::timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return t.tv_sec * int64_t(1'000'000'000) + t.tv_nsec; } void f(vector &v, int i) { for(int j = i; j >= 1; j--) { swap(v[j], v[j-1]); } } int main() { int n, m; cin >> n >> m; vector A(m); for(int &a : A) { cin >> a; a--; } vector v(n); for(int i = 0; i < n; i++) v[i] = i+1; for(int a : A) { f(v, a); } cout << v[0] << endl; return 0; }