from bisect import insort, insort_left
p=int(input())
seats = [(0,p+1)]
for_in range(int(input())):
    query=input()
    if query=="+":
        _,index=seats[0]
        print(index)
        left,right=seats.pop(0)
        if index>left:
            insort_left(seats,(left,index))
            if index<right:
                insorts(seats,(index,right))
                else:
                    _,index=map(int,query.split())
                    left,right=0,p+1
                    for l,r in seats:
                        left,right=l,r
                        seats.remove((l,r))
                        break
                    insort_left(seats,(left,index))
                    insort(seats,(index,right))
