N, M = map(int, raw_input().split()) shuffle_card = map(int, raw_input().split()) library = range(1, N+1) for c in shuffle_card: library.insert(0, library[c-1]) del library[c] print library[0]