from collections import deque

n, k = map(int, input().split())
seats = deque([(1, n)])  # Изначально есть одно свободное место с номерами 1 и n.

def add_passenger():
    if not seats:
        return -1  # Нет свободных мест.
    max_dist, max_seat = -1, 0
    for i, (left, right) in enumerate(seats):
        dist = (right - left) // 2
        if dist > max_dist:
            max_dist = dist
            max_seat = i
    left, right = seats[max_seat]
    middle = left + (right - left) // 2
    seats[max_seat] = (left, middle - 1)
    return middle

for _ in range(k):
    query = input()
    if query == "+":
        result = add_passenger()
        print(result)
    else:
        x = int(query[1:])
        left, right = seats.popleft()
        seats.append((left, x - 1))
        seats.append((x + 1, right))
