def find_max_distance_seats(n, k, requests):
    occupied_seats = set()
    max_distance_heap = []
    max_distance = -1

    result = []

    for request in requests:
        if request == "+":
            if max_distance == -1:
                seat = (n + 1) // 2
            else:
                seat = -heapq.heappop(max_distance_heap)
                occupied_seats.add(seat)

            result.append(seat)

            if not max_distance_heap:
                max_distance = -1
            else:
                max_distance = -max_distance_heap[0]

        else:
            occupied_seats.remove(-request)
            left_seat = max(seat for seat in occupied_seats if seat < -request) if occupied_seats else 0
            right_seat = min(seat for seat in occupied_seats if seat > -request) if occupied_seats else n + 1
            distance = (right_seat - left_seat) // 2
            max_distance = max(max_distance, distance)
            heapq.heappush(max_distance_heap, -distance)

    return result

n, k = map(int, input().split())
requests = [input() for _ in range(k)]

result = find_max_distance_seats(n, k, requests)
for seat in result:
    print(seat)
