#include <bits/stdc++.h>

using namespace std;

#define ld double
#define ll long long

struct place{
    place() = default;
    ll dist, begin, end;
    place(ll a, ll b, ll c): dist(a), begin(b), end(c) {};
};

struct cmps{
    bool  operator()(const place& a, const place& b) const{
        if (a.dist == b.dist) return a.begin < b.begin;
        return a.dist < b.dist;
    }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, m, cnt = 0;
    cin >> n >> m;
    set<place, cmps> metro;
    metro.insert(place(n, -1, n + 1));
    vector<pair<place, place>> cheliki;
    
    for (int i = 0; i < m; i++)
    {
        char op;
        cin >> op;
        if(op == '-'){
            int x;
            cin >> x;
            auto it1 = metro.lower_bound(cheliki[x].first);
            auto p1 = *it1;
            metro.erase(it1);
            auto it2 = metro.lower_bound(cheliki[x].second);
            auto p2 = *it2;
            metro.erase(it2);
            auto p = place(p2.end - p1.begin - 1, p1.begin, p2.end);
            metro.insert(p);
        cout << op << endl;
        }
        else{
            ll x;
            auto bx = --(metro.end());
            auto bs = (*bx);
            // assert(bx != metro.end());
            metro.erase(bx);

            if(cnt == 0){
                x = 1;
            }
            else if(cnt == 1){
                x = n;
            }
            else{
                x = ((bs).begin + (bs).end) / 2;
            }
            auto p1 = place(x - (bs).begin - 1, (bs).begin, x);
            metro.insert(p1);
            auto p2 = place((bs).end - x - 1, x, (bs).end);
            metro.insert(p2);
            cheliki.push_back({p1, p2});
            cnt++;
            // cout << x << '\n';
        }

    }
    
}
//