#include <iostream>
#include <set>
using namespace std;
typedef long long int lli;

#define plli pair<lli, lli>
#define mp(_first, _second) make_pair(_first, _second)

const lli MAX_SIZE = (lli)1e5 + 5LL;

lli N,
	Q;
char cmd;
lli ind;
lli place[MAX_SIZE], // place[i] = место, куда сел i-тый пассажир
	top;
set<plli> S; // pair = place - ind

void solve();
lli get_best_place();

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	solve();
	
	return 0;
}

void solve() {
	cin >> N >> Q;
	
	while (Q--) {
		cin >> cmd;
		
		if (cmd == '+') {
			place[top] = get_best_place();
			cout << (place[top] + 1LL) << '\n';
			
			S.insert(place[top]);
			++top;
		} else { // cmd == '-'
			cin >> ind; --ind;
			S.erase(place[ind]);
		}
	}
	
	return;
}

lli get_best_place() {
	if ((lli)S.size() == 0LL)
		return 0LL;
	
	lli best_place,
		max_d = -1LL;
	lli prev_place;
	for (auto it = S.begin(); it != S.end(); ++it) {
		if (it == S.begin()) {
			if (*it != 0LL) {
				best_place = 0LL;
				max_d = *it;
			}
			prev_place = *it;
			continue;
		}
		
		auto tmp = it;
		auto next_it = ++tmp;
		if (next_it == S.end()) {
			if (*it != N - 1LL) {
				lli new_place = N - 1LL;
				lli new_d = N - 1LL - *it;
				if (max_d < new_d) {
					best_place = new_place;
					max_d = new_d;
				}
			}
		}
		
		lli new_place = (prev_place + *it) >> 1;
		lli new_d = new_place - prev_place;
		if (max_d < new_d) {
			best_place = new_place;
			max_d = new_d;
		}
		
		prev_place = *it;
	}
	
	return best_place;
}
