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

#ifdef ORD_SET
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    template<typename T>
    using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#endif
#ifdef ROPE
    #include <ext/rope>
    using namespace __gnu_cxx;
#endif

// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

using ll = long long;
using ld = long double;
#define pll pair<ll, ll>
#define pb push_back
#define ff first
#define ss second
#define sp " "
#define en "\n"
#define bg begin()
#define ed end()
// #define sz size()
#define sz(x) (ll)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

void freopen(string s) { freopen((s+".in").c_str(), "r", stdin); freopen((s+".out").c_str(), "w", stdout); }
void EvrazGold() { ios_base::sync_with_stdio(false); cin.tie(NULL); }
ll binmul(ll a, ll b, ll c) { ll res = 0; while(b) { if(b&1) (res += a) %= c; (a += a) %= c; b >>= 1; } return res; }
ll binpow(ll a, ll b, ll c) { ll res = 1; while(b) { if(b&1) (res *= a) %= c; (a *= a) %= c; b >>= 1; } return res; }
template<typename T> T gcd(T a, T b) { if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b) { return a/gcd(a, b)*b; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ld rnd() { return rng()%INT_MAX*1.0/INT_MAX; }
const ll inf = 1e18+7, MX = LLONG_MAX, MN = LLONG_MIN;
const ll mod = 1e9+7, N = 3e5+5;
ll sit[N], timer;

ll f(ll x) {
    return x+x%2;
}

void psycho() {
    ll n, q;
    cin>>n>>q;
    set<pair<ll, ll>> a, a1;
    set<vector<ll>> b;
    a.insert({n, 1}), b.insert({f(n), -1, n});
    a1.insert({1, n});
    for(ll i=1; i<=q; i++) {
        string s;
        cin>>s;
        if(s[0]=='+') {
            ll len = (*b.rbegin())[2], len1 = -inf, lenn = -inf;
            auto it = a1.lower_bound({1, -inf});
            if(it!=a1.end() && (*it).ff==1) len1 = (*it).ss;
            auto ti = a.lower_bound({n, -inf});
            if(ti!=a.end() && (*ti).ff==n) lenn = (*ti).ff-(*ti).ss+1;
            if(len1>=lenn && len1>=(len+1)/2) {
                sit[++timer] = 1;
                ll l = 1, r = (*it).ss;
                a1.erase(it);
                a.erase({r, l});
                b.erase({f(r-l+1), -l, r-l+1});
                if(l<r) {
                    a1.insert({l+1, r});
                    a.insert({r, l+1});
                    b.insert({f(r-l), -l-1, r-l});
                }
            }
            else if((len+1)/2>=len1 && (len+1)/2>=lenn) {
                ll l = -(*b.rbegin())[1];
                ll r = l+len-1;
                ll x = (l+r)/2;
                sit[++timer] = x;
                a1.erase({l, r});
                a.erase({r, l});
                b.erase({f(r-l+1), -l, r-l+1});
                if(l<x) {
                    a1.insert({l, x-1});
                    a.insert({x-1, l});
                    b.insert({f(x-l), -l, x-l});
                }
                if(x<r) {
                    a1.insert({x+1, r});
                    a.insert({r, x+1});
                    b.insert({f(r-x), -x-1, r-x});
                }
            }
            else {
                sit[++timer] = n;
                ll l = (*ti).ss, r = n;
                a1.erase({l, r});
                a.erase(ti);
                b.erase({f(r-l+1), -l, r-l+1});
                if(l<r) {
                    a1.insert({l, r-1});
                    a.insert({r-1, l});
                    b.insert({f(r-l), -l, r-l});
                }
            }
            cout<<sit[timer]<<"\n";
        }
        else {
            ll x = sit[-stoll(s)];
            pair<ll, ll> L = {-inf, -inf}, R = {-inf, -inf};
            auto it = a.lower_bound({x-1, -inf});
            if(it!=a.end() && (*it).ff==x-1) L = {(*it).ss, (*it).ff};
            auto ti = a1.lower_bound({x+1, -inf});
            if(ti!=a1.end() && (*ti).ff==x+1) R = *ti;
            ll tl = x, tr = x;
            if(L.ff!=-inf) {
                a.erase({L.ss, L.ff});
                a1.erase({L.ff, L.ss});
                b.erase({f(L.ss-L.ff+1), -L.ff, L.ss-L.ff+1});
                tl = min(tl, L.ff);
            }
            if(R.ff!=-inf) {
                a.erase({R.ss, R.ff});
                a1.erase({R.ff, R.ss});
                b.erase({f(R.ss-R.ff+1), -R.ff, R.ss-R.ff+1});
                tr = max(tr, R.ss);
            }
            a.insert({tr, tl});
            a1.insert({tl, tr});
            b.insert({f(tr-tl+1), -tl, tr-tl+1});
        }
    }
    return;
}

signed main(/*Nurmyrza, Beibarys, Amir*/) {
    // freopen("");
    EvrazGold();
    ll tt = 1;
    // cin>>tt;
    for(ll i=1; i<=tt; i++) {
        psycho();
    }
}
