#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; i++) int main() { cin.tie(nullptr); int N, M; cin >> N >> M; vector num(N); rep(i, 0, N) num[i] = i; rep(i, 0, M) { int A; cin >> A; A--; int tmp = num[A]; for (int i = A; i > 0; i--) { num[i] = num[i - 1]; } num[0] = tmp; } cout << num[0] + 1 << '\n'; }