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

free_seats = [i for i in range(1, n + 1)]
occupied_seats = []

for _ in range(k):
    query = input().strip()

    if query == "+":
        # Находим свободное место с максимальным расстоянием до ближайшего занятого
        max_distance = -1
        seat_to_take = free_seats[0]

        if len(free_seats) == 1:
            seat_to_take = free_seats[0]
        else:
            for i in range(len(free_seats)):
                if i == 0:
                    distance = free_seats[i] - 1
                elif i == len(free_seats) - 1:
                    distance = n - free_seats[i]
                else:
                    distance = (free_seats[i] - free_seats[i - 1]) // 2

                if distance > max_distance:
                    max_distance = distance
                    seat_to_take = free_seats[i]

        print(seat_to_take)
        free_seats.remove(seat_to_take)
        occupied_seats.append(seat_to_take)
    else:
        seat_to_leave = int(query[1:])
        occupied_seats.remove(seat_to_leave)
        free_seats.append(seat_to_leave)
        free_seats.sort()

