from collections import deque
p, k = map(int, input().split())
seats = deque(range(1, p + 1))
for _ in range(k):
    query = input()
    if query == '+':
        seat = seats.popleft()
        print(seat)
    else:
        seat_to_free = int(query.split()[1])
        seats.append(seat_to_free)
