def main(): N, M = map(int, input().split()) cards = [card for card in range(1, N + 1)] #print(cards) for num in list(map(int, input().split())): digit = cards.pop(num - 1) cards.insert(0, digit) print(cards[0]) if __name__ == '__main__': main()