n, k = map(int, input().split())
seats = [(0, n + 1)]
result = []

for _ in range(k):
    query = input().strip()
    if query == "+":
        max_dist, index = max((b - a, i) for i, (a, b) in enumerate(seats))
        seat = (seats[index][0] + max_dist // 2)
        result.append(seat)
        left_interval = (seats[index][0], seat)
        right_interval = (seat, seats[index][1])
        seats.pop(index)
        if left_interval[1] - left_interval[0] > 0:
            seats.append(left_interval)
        if right_interval[1] - right_interval[0] > 0:
            seats.append(right_interval)
    else:
        seat_to_vacate = int(query)
        index = 0
        for i, (a, b) in enumerate(seats):
            if a < seat_to_vacate < b:
                index = i
                break
        left_interval = (seats[index][0], seat_to_vacate)
        right_interval = (seat_to_vacate + 1, seats[index][1])
        seats.pop(index)
        if left_interval[1] - left_interval[0] > 0:
            seats.append(left_interval)
        if right_interval[1] - right_interval[0] > 0:
            seats.append(right_interval)

for seat in result:
    print(seat)
