#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;
 
void psycho() {
    ll n, q;
    cin>>n>>q;
    set<pair<ll, ll>> a, b, a1;
    a.insert({n, 1}), b.insert({n, -1});
    a1.insert({1, n});
    for(ll i=1; i<=q; i++) {
        string s;
        cin>>s;
        if(s[0]=='+') {
            ll l = -(*b.rbegin()).ss, len = (*b.rbegin()).ff;
            ll r = l+len-1;
            auto it = a1.lower_bound({1, -inf});
            ll len1 = -1, lenn = -1;
            if(it!=a1.end() && (*it).ff==1) {
                len1 = (*it).ss-(*it).ff+1;
            }
            auto ti = a.lower_bound({n, -inf});
            if(ti!=a.end() && (*ti).ff==n) {
                lenn = (*ti).ff-(*ti).ss+1;
            }
            if(len1>=len/2+len%2 && len1>=lenn) {
                ll l = (*it).ff, r = (*it).ss;
                a1.erase(it);
                a.erase({r, l});
                b.erase({r-l+1, -l});
                sit[++timer] = 1;
                cout<<1<<"\n";
                if(l<r) {
                    a1.insert({l+1, r});
                    a.insert({r, l+1});
                    b.insert({r-l, -l-1});
                }
            }
            else if(len/2+len%2>=len1 && len/2+len%2>=lenn) {
                b.erase(prev(b.end()));
                a.erase({r, l});
                a1.erase({l, r});
                ll x = (l+r)/2;
                sit[++timer] = x;
                cout<<x<<"\n";
                if(x>l) {
                    a.insert({x-1, l});
                    a1.insert({l, x-1});
                    b.insert({x-l, -l});
                }
                if(x<r) {
                    a.insert({r, x+1});
                    a1.insert({x+1, r});
                    b.insert({r-x, -x-1});
                }
            }
            else {
                ll l = (*ti).ss, r = (*ti).ff;
                a.erase(ti);
                a1.erase({l, r});
                b.erase({r-l+1, -l});
                sit[++timer] = n;
                cout<<n<<"\n";
                if(l<r) {
                    a1.insert({l, r-1});
                    a.insert({r-1, l});
                    b.insert({r-l, -l});
                }
            }
        }
        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({L.ss-L.ff+1, -L.ff});
                tl = min(tl, L.ff), tr = max(tr, L.ss);
            }
            if(R.ff!=-inf) {
                a.erase({R.ss, R.ff});
                a1.erase({R.ff, R.ss});
                b.erase({R.ss-R.ff+1, -R.ff});
                tl = min(tl, R.ff), tr = max(tr, R.ss);
            }
            a.insert({tr, tl});
            a1.insert({tl, tr});
            b.insert({tr-tl+1, -tl});
        }
    }
    return;
}
 
signed main(/*Nurmyrza, Beibarys, Amir*/) {
    // freopen("");
    EvrazGold();
    ll tt = 1;
    // cin>>tt;
    for(ll i=1; i<=tt; i++) {
        psycho();
    }
}