#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define int ll
const int N = 2e5;
int n,q;
ll cm[N],f[N],s[N];
set<pair<ll,pair<ll,ll>>> st;
set<ll> t;
main()
{
    ll col = 0,cf = 0;
    cin >> n >> q;
    for(int i = 1;i <= q;i++){
        char tp;
        cin >> tp;
        if(tp == '+'){
            if(!col){
                cout << 1 << '\n';
                cm[cf +1]  = 1;
                t.insert(1);
            }else if(col == 1){
                st.insert({n - 1,{-1,-n}});
                cout << n << '\n';
                cm[cf + 1] = n;
                t.insert(n);
            }else{
                auto [x,y] = (*st.rbegin());
                ll pos = (-y.first - y.second) >> 1;
                st.erase({x,y});
                cm[cf + 1] = pos;
                t.insert(pos);
                st.insert({pos +y.first,{y.first,-pos}});
                st.insert({-y.second - pos,{-pos,y.second}});
                cout << pos  << '\n';                
            }
            col++;
            cf++;
        }else{
            ll f;
            cin >> f;
            f = cm[f];
            t.erase(f);
            col--;
            if(col == 0) continue;
            if(*t.rbegin() >= f && *t.begin() <= f){
                auto it = t.upper_bound(f);
                auto it1 = t.upper_bound(f);
                it1--;
                st.erase({f - *it1,{-*it1,-f}});
                st.erase({*it - f,{-f,-*it}});
                st.insert({*it - *it1,{-*it1,-*it}});
            }else{
                if(*t.rbegin() > f){
                    auto it = t.upper_bound(f);
                    st.erase({*it - f,{-f,-*it}});
                }else if(*t.begin() < f){
                    auto it1 = t.upper_bound(f);
                    it1--;
                    st.erase({f - *it1,{-*it1,-f}});
                }
            }
        }
    }
}