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

seats = [False] * (n + 2)  # Инициализация списка свободных мест

def find_max_distance():
    max_distance = -1
    max_distance_seat = -1
    current_distance = 0

    for i in range(1, n + 2):
        if seats[i]:
            current_distance = 0
        else:
            current_distance += 1

        if current_distance > max_distance:
            max_distance = current_distance
            max_distance_seat = i

    return max_distance_seat

for _ in range(k):
    query = input()
    if query == '+':
        seat = find_max_distance()
        seats[seat] = True
        print(seat)
    else:
        x = int(query[1:])
        seats[x] = False

