n, k = map(int, input().split())

seats = [0] * n
vacant_seats = list(range(1, n + 1))
answer = []

for _ in range(k):
    query = input()
    if query == "+":
        seat = vacant_seats.pop()
        seats[seat - 1] = 1
        answer.append(seat)
    else:
        seat = int(query[1:])
        seats[seat - 1] = 0
        vacant_seats.append(seat)
        vacant_seats.sort()
        answer.append(0)

for a in answer:
    print(a)
