// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#define ll long long
#define ld long double
#define ff first
#define ln endl
#define ss second
using namespace std;
using namespace __gnu_pbds;



void solve(){
	ll n, k; cin >> n >> k;
	multiset<ll> occ;
	multiset<pair<ll, pair<ll, ll>>, greater<pair<ll, pair<ll, ll>>>> dist;
	map<ll, ll> pl;
	ll cs=0;
	ll cad = 1;
	for (ll ctt=1; ctt<=k; ctt++){
		// cout << ": " << ctt << endl;
		char x; cin >> x;
		if (x=='+'){
			if (cs==0){
				cout << 1 << ln;
				occ.insert(1);
				pl[cad]=1;
				cad++;
				cs++;
			}else if (cs==1){
				cout << n << ln;
				occ.insert(n);
				dist.insert({n-1-1, {n-1, n-n}});
				pl[cad]=n;
				cad++;
				cs++;
			}else{
				auto md = *dist.begin();
				md.ss.ff=0-(md.ss.ff-n);
				md.ss.ss=0-(md.ss.ss-n);
				dist.erase(dist.begin());
				ll np = (md.ss.ff+md.ss.ss)/2;
				occ.insert(np);
				cout << np << ln;
				dist.insert({np-md.ss.ff-1, {n-md.ss.ff, n-np}});
				dist.insert({md.ss.ss-np-1, {n-np, n-md.ss.ss}});
				// cout << np-md.ss.ff-1 << " " << md.ss.ff << " " << np << ln;
				pl[cad]=np;
				cad++;
				cs++;
			}
		}else{
			ll num; cin >> num;
			if (cs<=1){
				cs--;
				pl[num]=0;
				occ.erase(1);
				continue;
			}

			// cout << "SPECIAL\n";
			ll rnum = num;
			num = pl[num];
			pl[rnum]=0;
			// cout << num << ln;
			auto it = occ.find(num);
			auto itl = it;
			auto itr = it;
			ll l=-1, r=-1;
			if (itl!=occ.begin()){
				itl--;
				l = *itl;
			}else{
				l=1;
			}
			if (itr!=occ.end()){
				itr++;
				r = *itr;
			}else{
				r=n;
			}
			occ.erase(it);
			// cout << l << " " << r << ln;
			// cout << num-l-1 << " " << l << " " << num << ln;
			// cout << r-num-1 << " " << num << " " << r << ln;
			dist.erase(dist.find({num-l-1, {n-l, n-num}}));
			dist.erase(dist.find({r-num-1, {n-num, n-r}}));
			dist.insert({r-l-1, {n-l, n-r}});
			cs--;
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	ll t=1; 
	// cin >> t;
	while (t--) solve();
}