Parking lot
The parking lot is arranged in a circle, with all parking spaces numbered consecutively from 1 to n. Cars arrive and leave throughout the day, each aiming for a specific parking space designated for its owner. If the desired space is occupied, the car will continue to move clockwise (following the sequence 1, 2, 3, ..., n, 1, 2, 3, ...) until it finds an available spot. If no spaces are available, the car will leave without parking.
Input
The first line of input provides two integers 1 ≤ n, m ≤ 100,000, where n represents the total number of parking spaces, and m indicates the number of events that occur during the day. Each event is either a car's arrival or departure. The subsequent m lines each describe one event. A car's arrival is denoted by "+ i" (with a space between the "+" and the number), where i is the initial target space for the car. A departure is indicated by "- i" (with a space between the "-" and the number), where i is the space number in the parking lot.
Output
For each car arrival, output a single line with the number of the space where the car parked, or -1 if no space was available. For each car departure, output 0 if a car was indeed parked in that space, and -2 if there was no car at space i.