#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
const int N = 2e5;
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define int long long



main(){
	int n, k;
	cin >> n >> k;
	set<pair<int, int> > A, B;
	vector<int> ans;
	while(k--){
		
		char type; cin >> type;
		if(type == '+'){
			if(A.size() == 0){
				A.insert({n-1, 1});
				B.insert({1, n-1});
				ans.push_back(1);
			}else if(A.size() == 1){
				A.insert({1, n});
				B.insert({n, 1});
				ans.push_back(n);
			}else{
				
			//	for(auto [sz, x] : A){
			//		cout << sz << " " << x << '\n';
			//	}
				
				auto it1 = A.rbegin();
				auto it = A.lower_bound({it1->ff, 0});
				int l = it->ss, r = it->ss + it->ff-1;
				int mid= (l + r + 1) >> 1;
				
				ans.push_back(mid);
			//	cout << l << ' ' << r << " = " << mid << '\n';
			//	cout << '\n' << '\n';
				B.erase({it->ss, it->ff});
				A.erase(*it);
				A.insert({mid-l, l});
				A.insert({r-mid+1, mid});
				B.insert({l, mid-l});
				B.insert({mid, r-mid+1});
			}
			cout << ans.back() << '\n';
		
		}else{
			int x; cin >> x;
			x--;
			int idx = ans[x];
		//	cout << idx << " = ";
			if(A.size() == 1){
				A.clear();
				B.clear();
				continue;
			}
			if(A.size() == 2){
				A.erase({1, n});
				B.erase({n, 1});
				continue;
			}
			auto it = B.lower_bound({idx, 0});
			if(it == B.end()) assert(false);
		
			int r = idx + it->ss-1;
			if(it==B.begin()) assert(false);
			it--;
			int l = it->ff;
	
			B.erase({idx, r-idx+1});
			A.erase({r-idx+1, idx});
			B.erase(it);
			A.erase({it->ss, it->ff});
			
			A.insert({r-l+1, l});
			B.insert({l, r-l+1});
			
		}
	}
	
	
	
	
}

