#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pp pair<ll,ll>
template<class T> istream& operator>>(istream& is, vector<T>& arr) { for(auto& i:arr) is>>i; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& arr) { for(auto& i:arr) os<<i<<" "; return os;}


signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.precision(30);
ll n,k;
cin>>n>>k;
set<pp> intv1 = { {n,-1} },intv2={ {1,n} };
vector<ll> pos;

while(k--)
{
string tt;cin>>tt;
ll tp='+';
if(tt!="+") tp = stoll(tt);

if(tp=='+'){
pp c = *intv1.rbegin();
ll maxl = (c.first-1)/2;
ll ind = (c.first-1)/2 + -c.second;

pp bg=*intv2.begin(), nd=*intv2.rbegin();

if(bg.first==1) if( (bg.second-1) >= maxl) c = {bg.second,-bg.first}, maxl=bg.second-1,ind=bg.first;
if(nd.first+nd.second-1==n) if( (nd.second-1)>maxl ) c = {nd.second,-nd.first},ind=n;

//cout<<"{"; for(auto i:intv2) cout<<i.first<<":"<<i.second<<" ";cout<<endl;

intv1.erase(c);
c.second*=-1;
intv2.erase( {c.second,c.first} );

//cout<<":::::::::::::::::"<<ind<<endl;
cout<<ind<<endl;
pos.push_back(ind);
ll l1 = ind-c.second;
ll l2 = (c.second+c.first-1)-ind;
if(l1) { /*cout<<"here1 "<<l1<<endl;*/ pp t = {l1,-c.second};  intv1.insert(t); intv2.insert({-t.second,t.first}); }
if(l2) { /*cout<<"here2"<<endl;*/ pp t = {l2,-(ind+1) }; intv1.insert(t); intv2.insert({-t.second,t.first}); }
}
else {
ll when = -tp;
ll wp = pos[when-1];

auto it = intv2.lower_bound( {wp,0} );

ll x0 = wp, x1 = wp;

if(it!=intv2.end() && it->first==wp+1) {
pp c = *it;
x1 = c.first+c.second-1;
intv2.erase(it);
intv1.erase({c.second,-c.first});
}

it = intv2.lower_bound( {wp,0} );
if(it!=intv2.begin()) {
it--;
pp c = *it;
ll ended = c.first + c.second -1;
if(ended==wp-1)
 x0=c.first,intv2.erase(it),intv1.erase({c.second,-c.first});
}

ll curl = x1-x0+1;
intv2.insert({x0,curl});
intv1.insert({curl,-x0});
}
}

}
