n, k = map(int, input().split())
seats = list(range(1, n + 1))
passenger_to_seat = {}
for _ in range(k):
   query = input().strip()
   if query == "+":
       max_distance_seat = max(seats, key=lambda seat: min(abs(seat - s) for s in passenger_to_seat.values()))
       passenger_to_seat[max_distance_seat] = None
       seats.remove(max_distance_seat)
       print(max_distance_seat)
   else:
       x = int(query)
       seats.append(x)
       seats.sort()
       del passenger_to_seat[x]