N, M, *A = map(int, open(0).read().split()) B = list(range(1, N + 1)) for a in map(lambda x: x - 1, A): B = [B[a]] + B[:a] + B[a + 1:] print(B[0])