#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int p, k;
    cin >> p >> k;

    vector<bool> occupied(p+1, false);
    vector<int> empty_seats;
    for(int i=1; i<=p; i++) {
        empty_seats.push_back(i);
    }

    string query;
    while(k--) {
        cin >> query;

        if(query == "+") {
            cout << empty_seats.front() << "\n";
            occupied[empty_seats.front()] = true;
            empty_seats.erase(empty_seats.begin());
        }
        else {
            int seat = stoi(query.substr(1));
            occupied[seat] = false;
            empty_seats.push_back(seat);
            sort(empty_seats.begin(), empty_seats.end());
        }
    }

    return 0;
}
