#include <iostream>
#include <vector>
#include <set>
#include <map>

using namespace std;
 
typedef long long ll;

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma optimization_level 3
 
// Defines
 
#define pb push_back // kak push_back 5
#define endl '\n'
#define FOR(i,start,end) for(int i = start;i < end;i ++)
#define REV(i,start,end) for(int i = start;i >= end;i --)
#define precal(x) fixed << setprecision(x)
#define F first
#define S second
#define sz(x) (ll)x.size()
#define all(x) (x).begin(),(x).end()
#define m_p make_pair
#define mt make_tuple
#define str to_string

// #ifndef ONLINE_JUDGE
//     #define cerr if(false) cerr
// #endif
 
const ll mxn = 1e6;
const ll k = 400;
// const ll org = 10000;
const ll inf = 1e9 + 7;
// const ll mod = 998244353;

ll n,cnt = 0;

char a[100][100];

ll t[mxn],f1 = inf,fn = inf;

map <ll,pair <ll,ll> > l,r;

bool used[100][100];

vector <ll> v[mxn];

int main(){
    // freopen("sparse.in","r",stdin);
    // freopen("sparse.out","w",stdout);
    // ios_base::sync_with_stdio(false);
    // cin.tie(nullptr);
    // cout.tie(nullptr);
    ll tt = 1;
    // cin >> tt; 
    while(tt --){
        ll n,q,p = 0;
        cin >> n >> q;
        ll cnt = 0;
        set <pair<ll,ll> > s;
        s.insert({5,n - 1});
        while(q --){
            char c;
            cin >> c;
            if(c == '+'){
                cnt ++,p ++;
                set <pair<ll,ll> >::iterator k = s.end();
                k --;
                pair <ll,ll> h = *k;
                ll sz = h.first,pos = n - h.second;
                if(p == 1){
                    t[cnt] = 1;
                    cout << 1 << endl;
                    s.erase(k);
                    s.insert({n - 1,n - 2});
                    r[1] = {n - 1,n - 2};
                }
                else if(p == 2 && t[1] != 0){
                    t[cnt] = n;
                    cout << n << endl;
                    s.erase(k);
                    s.insert({n - 2,n - 2});
                    l[n] = {n - 2,n - 2};
                }
                else{
                    if(pos == 1){
                        cout << 1 << endl;
                        t[cnt] = 1;
                        s.erase(k);
                        s.insert({sz - 1,n - 2});
                        r[1] = {sz - 1,n - 2};
                    }
                    else if(pos + sz - 1 == n){
                        cout << n << endl;
                        t[cnt] = n;
                        s.erase(k);
                        s.insert({sz - 1,n - pos});
                        l[n] = {sz - 1,n - pos};
                    }
                    else{
                        ll b = (pos + pos + sz - 1) / 2;
                        cout << b << endl;
                        t[cnt] = b;
                        s.erase(k);
                        s.insert({b - pos,n - pos}),s.insert({pos + sz - 1 - b,n - (b + 1)});
                        l[b] = {b - pos,n - pos},r[b] = {pos + sz - 1 - b,n - (b + 1)},r[pos - 1] = {b - pos,n - pos},l[pos + sz] = {pos + sz - 1 - b,n - (b + 1)};
                    }
                }
            }
            else{
                ll z;
                cin >> z;
                ll x = t[z];
                p --;
                if(x == 1){
                    ll sz = r[x].first + 1,pos = 1;
                    s.erase(r[x]),s.insert({sz,n - pos});
                    t[z] = 0;
                }
                else if(x == n){
                    ll sz = l[x].first + 1,pos = n;
                    s.erase(l[x]),s.insert({sz,n - pos});
                    t[z] = 0;
                }
                else{
                    ll sz = l[x].first + r[x].first + 1,pos = l[x].second;
                    s.erase(l[x]),s.erase(r[x]),s.insert({sz,pos});
                    t[z] = 0;
                }
                
            }
            // cout << endl;
            // for(auto i : s){
            //     cout << i.first << " " << n - i.second << endl;
            // }
            // cout << endl;
        }
    }
}
