def add_passenger(seats):
    max_distance = -1
    best_seat = None
    prev_occupied = -1

    if not seats[0]:
        max_distance = seats.index(True) if True in seats else len(seats)
        best_seat = 0

    for i, occupied in enumerate(seats):
        if occupied:
            gap = (i - prev_occupied) // 2
            if gap > max_distance:
                max_distance = gap
                best_seat = prev_occupied + gap
            prev_occupied = i

    if not seats[-1] and (len(seats) - 1 - prev_occupied) > max_distance:
        best_seat = len(seats) - 1

    seats[best_seat] = True
    return best_seat + 1

def remove_passenger(seats, seat_num):
    seats[seat_num - 1] = False

def process_requests(n, k, requests):
    seats = [False] * n
    output = []

    for request in requests:
        if request == "+":
            output.append(add_passenger(seats))
        else:
            remove_passenger(seats, int(request[1:]))

    return output

# Интерактивный ввод данных
n = int(input("Введите количество мест в вагоне (n): "))
k = int(input("Введите количество запросов (k): "))

requests = []
print(f"Введите {k} запросов, каждый запрос с новой строки:")
for _ in range(k):
    requests.append(input().strip())

# Вызов функции для обработки запросов
output = process_requests(n, k, requests)

# Вывод результатов
for seat in output:
    print(seat)
